Java Basic data types

Source: Internet
Author: User

1, Java Program starting point is----"public static void Main (String args[]);

2. Java identifier----The names of packages, classes, methods, parameters, and variables in Java can be made up of any order of uppercase and lowercase letters, numbers, underscores, and dollar signs, but identifiers cannot start with numbers and cannot use Java reserved words.

3, the definition of the constant, its value is fixed------"final

4, variable----"variable can be used to save the data, before using the variable must declare its pre-saved data type, in Java, the provision of eight basic data type variables to store integers, floating-point numbers, characters and Boolean values.

The data type of the variable: integer (int), long Integer (long), short integer, float (float), double-precision floating-point type (double), character type (char), String type (String)

Variable name restrictions are like identifiers

Assigning values to variables: 1, assigning values at the time of declaration

2, the first declaration after the assignment value

3. Assign values anywhere in the program

Query method for the default maximum value constants for Java:

classvariable_1{ Public Static voidMain (String args[]) {Longlong_max=Java.lang.Long.MAX_VALUE; intint_max=Java.lang.Integer.MAX_VALUE;  Shortshort_max=Short.max_value; bytebyte_max=Byte.max_value; System.out.println ("Long maximum" +Long_max); System.out.println (Maximum value of int +Int_max); System.out.println ("Short Max" +Short_max); System.out.println (Maximum value of Byte +Byte_max); }}

Java Basic data types

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.