Basic Syntax

Quotation

Use single quotes for literal chars, double quotes for literal Strings

char c = 'a';
String s = "hello";

They cannot be used any other way around (like in Python).

Cast long to int

long x = 0L;
int y = (int)(x);

Null/None?

null

'true' if True else 'false'

(exp == true)? true_handling: false_handling;

default value of B/boolean

-site

Boolean (with a uppercase 'B') is a Boolean object, which if not assigned a value, 
will default to null. 

boolean (with a lowercase 'b') is a boolean primitive, 
which if not assigned a value, will default to false.

Method to initilize array

int data[] = {10,20,30,40,50,60,71,80,90,91};

// or

int data[];
data = new int[] {10,20,30,40,50,60,71,80,90,91};

INT_MAX

Integer.MAX_VALUE //2147483647
Integer.MIN_VALUE //-2147483648

results matching ""

    No results matching ""