Learn the way to pay, this is the second time to learn Java, like clairvoyant, understand a lot of ideas and truth.
This blog is just a few of their own understanding of Java, specific definitions and usage in the encyclopedia.
Why do I record my learning process in the blog park, because I want someone to know that I am learning it, so that I form a kind of urge, so I can not easily abandon.
A simple summary of Java:
1: What is object-oriented programming, it is a programming idea.
By abstracting things into entities with attributes and behaviors to clearly program the level of sense, through modifiers, normative judgments to protect the security of the program, through inheritance to simplify the amount of code. (Do not summarize this before you have reviewed the polymorphism)
Object-oriented programming is that things are abstracted as entities (basic)--and encapsulated (secure)---Inheritance (brevity).
2: Meaning of the construction method:
A construction method is a way of instantiating a class object, creating a space within the heap with the new keyword, and constructing an instance object.
PS: Building blocks of code--a class typically requires a constructor method overload, which can be used to construct code blocks. It does this by adding code inside the block to the construction code before calling the construction method's internal code
As an example:
{
System.out.println ("I am Building code block");
}
Public Std () {
System.out.println ("I am a constructor");
}
Public STD (String name,int age) {
System.out.println ("I am the constructor two");
}
When constructing method STD () or STD (String name,int age) is called, the compiler will put the contents of the construction code block inside the constructor method
Such as:
Public Std () {
System.out.println ("I am Building code block");
System.out.println ("I am a constructor");
}
PPS: When a subclass is initialized, regardless of whether the subclass calls itself a constructor or not, it defaults to calling the parameterless constructor of the parent class, which shows how important the parameterless construction method of a class is.
3:static keywords
Static statics, I understand, is the function of making an object or method a public object or a public method. is to open a common area in memory, and each object instantiated through a class can access static variables or static methods.
A static variable is associated with a class, and all instances of the class share a static variable that is accessed using the class name. Static variable name or class name. static method name to access.
When will a static variable be used, for example, the count variable, for metering. A static method cannot invoke an instance variable, only a static variable can be called. At the same time, it cannot call this, it does not belong to any one instance.
Static code block, which is loaded first and can be used for initialization of static variables.
4:this and Super
Super is the keyword that is used when a subclass invokes the parent class member property. When a subclass is initialized, the parent class's parameterless constructor is called by default, even if the subclass initializes the call to a parameter-constructed method, which is still called the parameterless constructor method in the parent class.
This refers to the instance object itself, which can be called through this, the constructor method this (), or the member property of this. variable name; this. method ();
Super and this cannot be called simultaneously
5: Package
Encapsulation is to improve the security and standardization of the program. When programming, be clear about the scope and meaning of the four modifiers private, default, protect, public. Their limitations are waning.
In addition to modifiers, the input is rejected when the user enters illegal data. For example, in the set method, the limiting age range
PS: Here to pay special attention to the various naming of the normative
6: All classes are directly or indirectly inherited from the object class, and subclasses often rewrite its equal method and ToString method. When a class is decorated with the final keyword, it is the final class and cannot be inherited. If you modify a variable, it will not change and become a constant. How to remember the final keyword, final (final).
I have saved a lot of useful information:
1:java Naming conventions
Use of 2:package and import
Usage of 3:this keyword
4: Single Duty principle
5: Package
6: Package Synthesis case
7: The instruction of the Javadoc command
8: Inherit Upper, lower
9: Object-oriented
10: Simple Interest mode
Link: https://pan.baidu.com/s/12EJ8fDzm-HidOgxkKedlWw Password: 91hr
Interested students can download to understand, and welcome students to correct shortcomings. A blog post about Java file input and output, command line run script, etc. is updated later, so that you can complete your homework.
Java Road (ii)