|
Do you need help with your Java programming?
Click here for instant help with your Java code. |
Chapter 3: Data Types
Primitive types |
Java has two types of data types: Primitive Types and Reference Types. Primitive types are passed to and from methods 'by value' which means that each time a primitive type is passed as argument, a new value is created on the stack. Reference types are instances of classes (objects) and are handled later in this tutorial. Java has eight primitive types: |
boolean - has a value of 'true' or 'false' and 'false' is the default value. char - a 16 bit unicode character. byte - a signed integer of 8 bits. Values range from -128 to 127. short - a signed integer of 16 bits. Values range from -32768 to 32767 int - a signed integer of 32 bits. Values range from -2147483648 to 2147483647. long - a signed integer of 64 bits. Values range from -9223372036854775808 to 9223372036854775807. float - a floating point number of 32 bits. Values range from 1.4E-45 to 3.4028235E+38. double - a floating point number of 64 bits. Values range from 4.9E-324 to 1.7976931348623157E+308. |
| Previous | Next | |
Tutorial Home | ||
| Do you know your Java? | |
| Take a Ten-Question-Java-Quiz! | |
Search for code examples on this site
