Home Java Java - Data Types Your Ad Here
 

Search on this site

Related Items

Advertisement Partners

Job Search

Click here to search all jobs Powered by Monster.

Advertisements

Study in Russia
Java - Data Types PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Admin   
Thursday, 19 February 2009 08:33

 

Primitive Data Types

Size (in bits)

Range

   

Boolean

8

0 to 2^16-1

Char

16

0 to 2^16-1

Byte

8

-2^7 to 2^7-1

Short

16

-2^15 to 2^15-1

Int

32

-2^31 to 2^31-1

Long

64

-2^63 to 2^63-1

Float

32

 

Double

64

 

 

Signed Integral Data Type:
Byte (-2^7 to 2^7-1)
Short (-2^15 to 2^15-1)
Int (-2^31 to 2^31-1)
long (-2^63 to 2^63-1)

Floating Point Types:
float
double

Literals:
1) A literal is a value that may be assigned to a primitive or string variable or passed as an argument to a method call.
2) Using a literal representation of it creates a constant value in java.

Boolean Literals
1. true boolean isBig = true;
2. false boolean isLittle = false;

String literals
1) A string literal is a run of text enclosed in double quotes.
String s = " This is a String Literal. ";

Char Literals
1) Java characters are in Unicode, which is a 16- bit encoding.
2) A char literal can be expressed by enclosing the desired character in single quotes:
char c = 'w';
3) Java supports a few escape sequences for denoting special characters.
E.g. '\n' for new line.

Integral literals
1) Integral literals may be expressed in decimal, octal or hexadecimal.
E.g. 28, 0.34, 0*1c

Floating-point literals
2) A floating point literal expresses a floating-point numerical value.
e.g. 1.414, 4.2E+21, 1.828f, 1234d

White space
3) Space, tab or newline.

Separators
( ) { } [ ] ; , .
Parentheses braces brackets semi-colon comma period

Comments
Search RSS
Only registered users can write comments!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 

Donate & Support Us

Enter Amount:

Login Form



Joomla Templates by Joomlashack