1.java Idea of purpose
All things are objects, and objects are produced by concern.
A class is an extract of an object that is an instance of a class.
The three major features of 2.javaOO:
Encapsulating inherited polymorphic Abstractions
3 Properties and Behavior
attribute: Refers to what value data the object has.
Behavior: Is what the object can do, or what we want these objects to do.
Usage is: Class variable name = new Class ();
variables, attributes;
Variable. method ();
4. Construction Party:
A. role: Generating Objects
B. details:① If a class does not have a write construct,the JVM will give it a default public parameterless construct.
② Once a developer has written a construction method, theJVM does not provide a default construct.
C. syntax: The ① method name must be consistent with the class name.
The ② constructor method does not have a return type. (Not even void )
D. implementation steps:
① Dividing Space
② attribute in this space
③ to initialize a property
④ executes the code of the writing inside of our re-structuring method
5. Standard JavaBean:
A. attribute --The variable property is private, and the corresponding get,Set method is written. ( in Eclipse,theboolean type is changed to get )
B. construction -- There must be a public non-parametric structure.
C. The final writing of functional methods.
Ta.setage (Ta.getage () + 1); Implement the Age attribute increment of Ta object
6. three ways to Change program control:
A. invocation of a method
B. SELECT statements
C. Looping statements
7. There are three cases when the method is executed:
A. method returns a value
B. method does not return a value
C. method throws an exception
data transfer in 8.Java:
in Java, only value is passed, and the base data type is stored in a different way than the reference data type.
9.java and Memory:
memory is divided into Heap , Stack , Data Segment , Code Snippet four areas.
A. local variable re-stack area
B.new out in the heap area
C. string constant re-data segment
use of 10.this:
A. for properties, methods, This now refers to the current object
int a = This.age; Property
This.mail (); Method
B. call another constructor of this class in one of the constructor methods to achieve the code reuse of the construction method
This ();
This (age);
Note:this () can only be written in the first sentence of this class of construction method
One. array of reference types:
A. syntax:
element type [] Array name = new element type [length];
Student [] allstus = new Student [5]; Initializing an array
Allstus[0] = new Student (); Initializing a reference type element
Allstus[0].setname ("Zhang San"); Set method Assignment Value
B. There are two ways to declare an array as a formal parameter:
① Traditional Way []-- callers can only pass array objects in
ChangeCase (a[]);
}
public static void Changecse (char [] array) {
the new way after ②jdk1.5 ... - the caller can either pass an array object or pass any number of array elements in
ChangeCase (' W ', ' O ', ' r ', ' L ', ' d ');
}
public static void Changecse (char ... array) {
Java OO Object-oriented attention point one