API documentation is very important! ! !
While thinking and writing, I will have a lot of ideas.
Frequently printing something is very helpful for debugging the program.
Check the API documentation more, type the code more, and type after you understand it.
Memorizing is a good way to study with high intensity in a short period of time.
Keep the example program well. If you need to use it in the future, check the API and write it according to the writing method of the example program.
Three points support your development: technology, management and communication.
In this question, what are the classes and objects
What properties should the classes and objects have and methods
What is the relationship between classes and classes
Methods Name
Parameters of method
Return value of method
Understand how memory, stack, heap, data seg, and code run
package com.bjsxt.java140;//1. The company’s domain name is reversed Come over, followed by the project name, etc.
public class Cat {
}
public class Dog {
public static void main(String[] args) {
com.bjsxt.java140.Cat c = new com.bjsxt.java140.Cat();//2. The compiled class must be located in the correct directory
}
}
import com.bjsxt.java140.Cat; //3. Import package
public class Dog {
public static void main(String[] args) {
Cat c = new Cat() ;//4. Abbreviation
}
}
***
When rewriting the method, copy, do not type the wrong method name.
private
default
protected
public
class can only be a constructor in public and default
During the construction process of the subclassmustcall the construction method of the parent class once
The subclass uses super(arguments list) in its own construction method to call the parent class Constructor method
Use this(arguments list) to call other constructor methods of this class
If super is called, it must be written in the subclass The first line of the construction method
Three necessary conditions for the existence of polymorphism:
There must be inheritance
There must be overriding
The parent class reference points to the child class object
It is important to observe the name and line number of the error
Be able to handle it Those that cannot be processed must be thrown (throws Exception)
5 Keywords: try, catch, finally, throws, throw
Catch the small one first, then the big one
Rewrite method, The exceptions thrown must be consistent or not thrown
Array
a = new int[3];//Allocate space
a[0] = 1; a[2] = 5;a[3] = 7;date days[ ];//Declare the array nameGenericdays = new date[3];//Allocate space
days[0] = new date(1, 4, 2017);
days[1] = new date (2, 4, 2017);
days[2] = new date(3, 4, 2017);
Container
Generic➕ Automatic packaging and unboxing (auto-boxing&unboxing) can omit forced conversion
IO
Output stream
Byte stream
Character stream
Node stream
Processing flow
Thread
Process is a static concept, and threads are actually running in the machine.
At the same point in time, a CPU can only support one thread executing.
If you can use the interface, don't inherit from the Thread class. This will be more flexible.
synchronized, when this method is executed, the current object is locked.
network programming
The above is the detailed content of Java learning experience sharing. For more information, please follow other related articles on the PHP Chinese website!