POINTS TO REMEMBER

• An exception which is not thrown in the "try" block (for example, thrown in a "catch" block) is

not handled by subsequent "catch" blocks, but will rather be sent to the caller of the method. Before

this happens, "finally" block is executed. Subsequent code after "finally" remains unreached if that

exception remains uncaught after the execution of "finally" block.
• If two or more interfaces declare a variable with the same name, then a class implementing these

interfaces cannot refer to that variable by its simple name as it leads to ambiguity (even if the values

of the variable is same in both the interfaces ). The ambiguity can be avoided by using fully qualified

names e.g. Interface1.varName and Interface2.varName.
• An object can be eligible for garbage collection even if there are references pointing to the object,

as long as the objects with the references are themselves eligible for garbage collection.
• The unary post-fix operators and all binary operators, except for assignment operators, associate

from left to right. All other operators associate from right to left.
• Floating point modulo (%) by zero produces NaN , but floating point divide by zero does not.
• Integer division truncates to the next lower integer value in the absolute sense, but division by right

shifting truncates to the next lower integer value in an algebraic sense. So, -7/2 == -3 but -7 >> 1 == -4.
• Native methods cannot be "abstract", or "strictfp".
• An abstract method cannot be static, final, synchronized, native, private, or strictfp.
• After a thread has started, it will continue to run even if its reference is set to null. A running thread

has a reference in a ThreadGroup even if your program does not retain one. Thus a running thread is

never garbage collected.
• A NullPointerException is thrown when an application attempts to use null in a case where an object

is required.
• A null reference may be used to access a static variable or method.

• A local class cannot have any access modifier.
• The "this" variable is not a normal reference variable that can be changed by statements like this = new A();

"this" cannot be used to refer to local variables.

0 comments:

Post a Comment