them are in packages within package java. This does not import all available classes.*/ Static import declaration This type of declaration has been available since J2SE 5.0. Static import declarations allow access to static members defined in another class, interface, annotation, or enum; without specifying the class name: import static java.lang.System.out; //'out' is a static field in java.lang.System public class HelloWorld { public static void main(String[] args) { /* The following line is equivalent to: System.out.println("Hi World!"); and would have been incorrect without the import declaration. */ out.println("Hello World!"); } } Import-on-demand declarations allow to import all the fields of the type: import static java.lang.System.*; /* This form of declaration makes all fields in the java.lang.System class available by name, and may be used instead of the import declaration in the previous example. */ Enum constants may also be used with static import. For example, this enum is in the package called screen: public enum ColorName { RED, BLUE, GREEN }; It is possible to use static import declarations in another class to retrieve the enum constants: import screen.ColorName; import static screen.ColorName.*; public class Dots { /* The following line is equivalent to 'ColorName foo = ColorName.RED', and it would have been incorrect without the static import. */ ColorName foo = RED; void shift() { /* The following line is equivalent to: if (foo == ColorName.RED) foo = ColorName.BLUE; */ if (foo == RED) foo = BLUE; } } Operators Operators in Java are similar to those in C++. However, there is no delete operator due to garbage collection mechanisms in Java, and there are no operations on pointers since Java does not support them. Another difference is that Java has an unsigned right shift operator (>>>), while C's right shift operator's signedness is type-dependent. Operators in Java cannot be overloaded. Control structures Conditional statements if statement if statements in Java are similar to those in C and use the same syntax: if (i == 3) doSomething(); if statement may include optional else block, in which case it becomes an if-then-else statement: if (i == 2) { doSomething(); } else { doSomethingElse(); } Like C, else-if construction does not involve any special keywords, it is formed as a sequence of separate if-then-else statements: if (i == 3) { doSomething(); } else if (i == 2) { doSomethingElse(); } else { doSomethingDifferent(); } Also, note that the ?: operator can be