1.1-java ways to create packages and classes

Source: Internet
Author: User

1.new-package-naming method com begins. The middle name. The class to be created in the background

2. Create Class-new-class Select the Main method

Code samples compile and save a bit to output information, has not been saved will not output

Package com.chongrui.test;

public class Test {

public static void Main (string[] args) {
BYTE mybyte=124;
Short myshort= 32564;
int myint = 45784612;
Long MyLong = 4678951L;
Long result =mybyte+myshort+myint+mylong;
System.out.println ("Four added results +:" +result);
}

Package com.chongrui.test;

public class Sumnuber {

public static void Main (string[] args) {
TODO auto-generated Method Stub
float f1=12.23f;
Double d1= 4562.12d;
Double d2= 4567.1564;
Double result=f1+d1+d2;
SYSTEM.OUT.PRINTLN ("The result of adding three floating-point types is:" +result);
}

}

Output results three floating-point additions result in: 9141.506399542235

Package com.chongrui.test;

public class Export {

public static void Main (string[] args) {
TODO auto-generated Method Stub
int i = ' d ';
char C = 97;
System.out.println ("The Unicode encoding of the character D is" +i);
System.out.println ("the character represented by the Unicode code 97 is" +c);
}

}

Package com.chongrui.test;

public class Export {

public static void Main (string[] args) {
TODO auto-generated Method Stub
int i = ' d ';
char C = 97;
System.out.println ("The Unicode encoding of the character D is" +i);
System.out.println ("the character represented by the Unicode code 97 is" +c);
}

}

The Unicode encoding for character D is 100
The character represented by the Unicode code 97 is a

1.1-java ways to create packages and classes

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.