Guia scjp

Solo disponible en BuenasTareas
  • Páginas : 12 (2943 palabras )
  • Descarga(s) : 0
  • Publicado : 17 de julio de 2010
Leer documento completo
Vista previa del texto
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 bea 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: char c1 = '\u0057' char c1 = 'w' char c1 = 87 char c1 = (char) 87 (acc to RHE) 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 tryblock 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() andresume() 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 validoverload. •Inner classes defined local to a block may not be declared to be static. •Mmember inner classes cannot have the same name as enclosing class, but they CAN subclass the enclosing class. •If an instance of the inner class had to refer to the associated instance of the enclosing class, then the following syntax could be used: EnclosingClass myPart = EnclosingClass.this; •No datatype isautomatically converted to a char. However, you can cast to a char. •Solaris uses pre-emptive scheduling; Windows & Mac uses time-slicing. •A monitor is any object that has some synchronized code. •If you have a sycnhronized method in a class, a subclass with an overriding method does not

have to declare it to be synchronized. •A static method may not be overridden to be non-static, and vice-versa.•equals() method just returns false even if the object reference types are different. It does not throw an exception. •The add(..) method of the Set returns false if you atttempt to add an element with a duplicate value, but no exception is thrown. •Constructors CAN be private. •Anonymous classes cannot have constructors. •-(i) = ~(i) + 1 •The test condition (assuming i is an int): If (i=2) willgive a compiler error because the test condition expects a boolean and the assignment (i=2) returns an int •While using the RandomAccessFile constructor, if the file is not present, a mode "r" throws a FileNotFoundException. If "rw" mode is used, a new file is created with zero length. •Applets can't have a constructor with arguments. It can have constructor with no arguments. •Any component canhave menu barsor pull-down menus, although only frames have a method for adding a menubar. •Double.NaN == Double.NaN //returns false But, if Y = X = Double.NaN, X.equals (Y) returns true •Also, +0.0 == -0.0 //returns true But, if Y = +0.0 and X = -0.0 , X.equals (Y) returns false •For shift operators, >>, >>, unary numeric promotion is applied to each operand separately, and the datatype of the...
tracking img