Java Learning Notes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.