Java class inclusion Function
When writing a java program, we sometimes see this situation.
For example:
Class B {}
Class {}
New A (B) // in this statement, Class A contains Class B, meaning Class A can directly use Class B object class to call any data of Class B.
Here I give a metaphor to the human body.
For example, there is a human class person {}
There is a head class head {}
There is a body class body {}
There is a lower extremity class foot {}
Here we create a Head class
Head h = new head ();
One physical class
Body B = new body ();
One Lower Extremity
Foot f = new foot ();
Finally, create a human object.
Person p = new person (h, B, f );
In person, you can call any attributes of the header at will. In this way, you can divide this person into more details, you have to be more flexible.
I don't know if this is true or not!
What is the role of a class set in Java?
It is not an infinite Object and cannot save an infinite Object.
What does he do? You use him. This is his role.
Just like a city child can hardly understand some of the ideas of a child in a poor mountainous area, when you use this type in a specific scenario, you will understand how useful it is.
Although it looks like nonsense, it is definitely not nonsense.
What are the total classes in java? What are the specific roles of various types?
Java beginners mainly use five classes ..
Java. lang-contains some core classes in the java language, such as String, Math, Integer, System, and Treak.
Java.net-class that contains Network-related operations.
Java. io-Contains classes that provide multiple input/output functions.
Java. util-contains some Utility Classes and data structure classes. Such as functions and collections related to date calendars.
Java. SQL-contains the class used to access the database.