Java Section No. 06 eight Big data types

Source: Internet
Author: User
Tags true true

2016-06-28

Integral type
1 bytes of 8 bits

1 byte1 byte -128~127
2 Short2 byte -32768~32767
3 int4 bytes plus or minus 2 billion more use the most
4 Long8 byte is especially large, when int is not enough, it will use long

 Packageday06; Public classTestFloat { Public Static voidMain (string[] args) {intI1=1;//declaring an int type variable        intI2=3; floatf1=1f;//declaring a float type variable        floatF2=3f; floatRESULT1,RESULT2;//variables that record resultsRESULT1=i1/i2;//The result should be 0 .RESULT2=F1/F2;//The result should be 0.333333 .System.out.println ("Result1=" +RESULT1); System.out.println ("Result2=" +result2); }}

Character type
5 char occupies 2 bytes, in Unicode encoding format, supports Chinese

 Packageday06; Public classTestchar { Public Static voidMain (string[] args) {CharChar1= ' a '; CharChar2= ' A ' +1; CharChar3= ' A '-1; System.out.println ("Char1=" +char1); System.out.println ("Char2=" +char2); System.out.println ("Char3=" +char3); //in the Unicode encoding table ' a B    }}

Floating point Type

6 float 4 byte single precision
7 Double8 byte double precision with up to

Boolean type
8 Boolean
True True
False false

 package   day06;  public  class    Testboolean { static  void   main (string[] args) {boolean  b=true ; //         declares a Boolean type variable b  if   (b) {System.out.println ( "b=" +b+ "satisfies the condition, if statement executes" );  else  {System.out.println ( "b="        +b+ "The condition is not met, the Else statement executes" ); }    }}

Resources

[1] Java Easy Start Classic tutorial "full version"

Java Section No. 06 eight Big data types

Related Article

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.