diff options
author | Jakehp <JakeHP@Zoho.com> | 2013-06-29 12:46:34 -0500 |
---|---|---|
committer | Jakehp <JakeHP@Zoho.com> | 2013-06-29 12:46:34 -0500 |
commit | d32bad8aed47e58c4f675d9487537ac42d54004e (patch) | |
tree | fb4123a38b4cadac2e9ac2b06310b3f67f7209d2 /java.html.markdown | |
parent | 2669bc8ff63e1efa26ccb372c02b9453e0c4cb02 (diff) |
up
Diffstat (limited to 'java.html.markdown')
-rw-r--r-- | java.html.markdown | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/java.html.markdown b/java.html.markdown index d780d515..48e1ff36 100644 --- a/java.html.markdown +++ b/java.html.markdown @@ -36,38 +36,23 @@ System.out.println("Integer: "+10+"Double: "+3.14+ "Boolean: "+true); // Types /////////////////////////////////////// -// You have to declare variables before using them. A variable declaration -// requires you to specify its type; a variable's type determines its size -// in bytes. - -// Integers -int x_int = 0; - -// shorts are usually 2 bytes -short x_short = 0; - -// chars are guaranteed to be 1 byte -char x_char = 0; -char y_char = 'y'; // Char literals are quoted with '' - -// longs are often 4 to 8 bytes; long longs are guaranteed to be at least -// 64 bits -long x_long = 0; -long long x_long_long = 0; - -// floats are usually 32-bit floating point numbers -float x_float = 0.0; - -// doubles are usually 64-bit floating-point numbers -double x_double = 0.0; - -// Integral types may be unsigned. This means they can't be negative, but -// the maximum value of an unsigned variable is greater than the maximum -// value of the same size. -unsigned char ux_char; -unsigned short ux_short; -unsigned int ux_int; -unsigned long long ux_long_long; +// Byte - 8-bit signed two's complement integer (-128 <= byte <= 127) + +// Short - 16-bit signed two's complement integer (-32,768 <= short <= 32,767) + +//Integer - 32-bit signed two's complement integer (-2,147,483,648 <= int <= 2,147,483,647) +int x = 1; + +//Long - 64-bit signed two's complement integer (-9,223,372,036,854,775,808 <= long <= 9,223,372,036,854,775,807) + +//Float - Single-precision 32-bit IEEE 754 Floating Point + +//Double - Double-precision 64-bit IEEE 754 Floating Point + +//Boolean - True & False + +//Char - A single 16-bit Unicode character + // Other than char, which is always 1 byte, these types vary in size depending // on your machine. sizeof(T) gives you the size of a variable with type T in |