The 1.package statement is placed at the beginning of the file, the function is to put the current file into the package pointed;
2. Two methods of creating multithreading,
The first type:
Inherit the extended thread abstract class and implement the Run () method, calling the start () method to create the thread;
Class A extends thread{
public void Run () {
System.out.println ("AAAA");
}
}
The second type:
Implement the Runnable interface,
Class A implements runnable{
public void Run ()
{
System.out.println ("AAAA");
}
}
public class test{
public static void Main (String []args) {
A aa = new A ();
Thread dd = new Thread (AA);
Aa.start ();
}
}
Example of a 3.Java applet applet:
Import Java.applet.Applet;
Import Java.awt.Graphics;
public class JApplet extends Applet {
public void Paint (Graphics g)
{
g.DrawString ("Hello friend:", 60,20);
g.DrawString ("Welcome to Javaapplet", 50, 40);
}
}
There are 8 basic data types in 4.java, Boolean, Char, Byte, short, int, long, float, double,
Composite data types: arrays, classes, interfaces (interface)
The custom identifier begins with the letter, "_", "$"
Constant final static statics
int m=2,n=1;
M+=m-=n; M= (m+m)-=n; Execute from left to right
System.out.println (m);
3
5.
Java Learning notes