Monday 9 July 2012

Points to Remember


                                                  Points To Remember for SCJP


The datatype in a switch statement must be convertible to int, i.e., only byte, short, char and int
can be used in a switch statement, and the range of the datatype used must cover all of the cases
(case statements).
An integer literal (w/o a decimal pt) is assumed to be a 32-bit int primitive, but a value containing
a decimal point is assumed to be a 64-bit double.
Wrapper classes for primitives produce immutable objects.

• Java characters are 16-bit unicode characters, and they can be initialized in the following ways:
o char c1 = '\u0057'
o char c1 = 'w'
o char c1 = 87
o char c1 = (char) 87 (acc to RHE)
o char c1 = '\r'

• instanceof operator can take a class, an interface or an array type as an argument.
• To test if an object is an array, use: myObject.getClass().isArray();
• MenuContainer interface is implemented by Container, Frame, Menu and MenuBar
• An identifier must begin with a letter, a dollar sign ($), or an underscore. Subsequent characters
maybe letters, $, underscore, or digits, but NOT other characters liek %, &, etc.
• The keywords syncrhonized, private and protected cannot be used with a class.
• A variable declared inside a try block cannot be used in the catch block.
• If no super-class constructor is explicitly called, and there is no call to other constructor (using
this(..)), the default constructor of the superclass (w/o any arguments) is automatically called.
• wait(), notify() and notifyAll() are the instance methods of Object class, not Thread class (but they
are inherited by Thread class).
• stop(), suspend() and resume() are deprecated methods in Java 1.2
• References to member methods are resolved at runtime using the type of object, but the references
to member variables are computed at compile time using the type of the reference.
• Javadoc documentation does not list private variables and methods.
• A valid overload differs in teh number or types of arguments. Difference is return type only is not
a valid overload.
• Inner classes defined local to a block may not be declared to be static.
• Member inner classes cannot have the same name as enclosing class, but they CAN subclass the
enclosing class.

No comments:

Post a Comment