Java Learning notes: data types for Java

Source: Internet
Author: User
Tags float range

is the basic data type of Java

 PackageCom.hgd.study;/*** Data type of Java *@authorHutiger **/ Public classDataType { Public Static voidMain (string[] args) {//syntax for defining a data type    /** 1. Data type variable name = literal * 2. Data type variable name; * Variable name = literal 1 * Variable name = literal 2 * Variable name = literal 3*/         /** Long range -2^63-->2^63-1 * int range -2^31-->2^31-1 * Short range -2^15-->2^15-1 * Byte range -2^7 -->2^7-1 * Float range 2^127-->2^149-1*/     Longlmin=-9223372036854775808l;//defines the type of a long to be case-insensitive in L     Longlmax=9223372036854775807l; floatf=9.98f;//defines a single-precision floating point type that needs to be followed by an F case insensitive     Doubled=95.00d;//defining a double-precision floating-point type needs to be followed by an F case insensitive          Booleanfals=false;//Boolean typeSystem.out.println (Fals);//falsefals=true;//The literal value of a variable can be changedSystem.out.println (Fals);//true//Char type     CharC= "; C= ' 1 '; C= ' People '; //----------------------Practice     intX=1;     SYSTEM.OUT.PRINTLN (x); Chary = ' 1 ';     System.out.println (y); //Java is a strictly differentiated data type languageSystem.out.println (x+2);//result =3System.out.println (y+2);//result =51}}

Java Learning notes: data types for Java

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.