Fundamentals of the Java SE Foundation

Source: Internet
Author: User
Tags java se

Process oriented:
A student to get up at 7 o ' clock, eat dinner before 8 o'clock, 8:30 class, then 12 to class, then eat lunch and sleep, and then 15 classes, know 19 o ' clock to eat dinner, but also late self-study, finally sleep.
A teacher gets up 7 o'clock, eats breakfast, lectures, eats naps, attends classes, eats, evenings tutoring, sleeps.
This is a day's rest for a student and a teacher.
Object-oriented:
Student: Event (Wake up, Eat, Class), attribute (time)
Teacher: Events (Get up, eat, lecture), Attributes (time)
Object-oriented features:
Encapsulation: So that a single file between high cohesion and low coupling, will have a certain connection between the processing logic or common features extracted into a separate Java class, encapsulation can make large programs have a clear structure and hierarchy.
Inheritance: All things are objects, the biological classification system is a meta-system, usually comprising seven main levels: species, genus, branches, eyes, outlines, doors, boundaries. Seed (species) is the basic unit, the relatives of the species to belong to the genus, relatives belong to the branch, branch in the eye, the outline, the outline in the door, the door in the realm. This best describes "inheritance". For example, students, teachers, cooks, programmers, who are all people, are satisfied with the behavior of eating and sleeping, and have the attributes of height and weight. So the student inherits the person, the teacher waits for all heirs.
Polymorphism: On the basis of "inheritance", where the subclass differs from the parent class is polymorphic, the parent class provides the interface (given the method, but not the implementation), and the subclass is implemented in its own way. Just as squares and triangles calculate the area, there are areas that have different methods of calculation.

Abstract classes and Interfaces:
Abstract classes can be seen as the encapsulation of properties and behaviors common to multiple entities, such as hero machines in aircraft wars, enemy planes, bees, bullets, and so on, which have wide heights and picture properties, and extract these attributes as "flier" abstract classes. It can be said that an abstract class is a common parent class of several classes.
Interface can be said to be a special case of abstract class, generally only for a class design, when a class is both what and what is used to implement the interface, the interface generally defines a class specific methods or properties. Abstract classes can have non-abstract methods, but the interface is all abstract methods, the abstract class property default protected, specifically for the inheritance of the existence, the interface property default final, can not be changed.

Inner class:
A class that is defined in a method or outside a method in a class. You can access the variable of the class to which it belongs, if the local variable must be the final type.

Class a{    class b{} public    void Show () {        class c{}}    }    

  


Anonymous inner class:
No reference name, only variables declared

Interface Inter1{}class ca{public    void Show (Inter1 i) {}}new Ca (). Show (New Inter1 ().);

--Just for the life of yourself

Fundamentals of the Java SE Foundation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.