Free Web Hosting Free Domain Name Service
JAVA TIPS
  • SCJP Tips/Traps

    What are the potential trips/traps in the SCJP exam?

    1. Two public classes in the same file.
    2. Main method calling a non-static method.
    3. Methods with the same name as the constructor(s).
    4. Thread initiation with classes that don't have a run() method.
    5. Local inner classes trying to access non-final variables.
    6. Case statements with values out of permissible range.
    7. Math class being an option for immutable classes !!
    8. instanceOf is not the same as instanceof
    9. Private constructors
    10. An assignment statement which looks like a comparison if( a=true)...
    11. System.exit() in try-catch-finally blocks.
    12. Uninitialized variable references with no path of proper initialization.
    13. Order of try-catch-finally blocks matters.
    14. main() can be declared final.
    15. -0.0 == 0.0 is true.
    16. A class without abstract methods can still be declared abstract.
    17. RandomAccessFile descends from Object and implements DataInput and DataOutput.
    18. Map does not implement Collection.
    19. Dictionary is a class, not an interface.
    20. Collection is an Interface where as Collections is a helper class.
    21. Class declarations can come in any order ( derived first, base next etc. ).
    22. Forward references to variables gives compiler error.
    23. Multi dimensional arrays can be sparse ie. if you imagine the array as a matrix, every row need not have the same number of columns.
    24. Arrays, whether local or class-level, are always initialized
    25. Strings are initialized to null, not empty string.
    26. An empty string is NOT the same as a null string.
    27. A declaration cannot be labelled.
    28. continue must be in a loop( for, do , while ). It cannot appear in case constructs.
    29. Primitive array types can never be assigned to each other, even though the primitives themselves can be assigned. ie., ArrayofLongPrimitives = ArrayofIntegerPrimitives gives compiler error even though longvar = intvar is perfectly valid.
    30. A constructor can throw any exception.
    31. Initializer blocks are executed in the order of declaration.
    32. Instance initializer(s) gets executed ONLY IF the objects are constructed.
    33. All comparisons involving NaN and a non-Nan always result in false.
    34. Default type of a numeric literal with a decimal point is double.
    35. integer (and long ) operations / and % can throw ArithmeticException while float / and % will never, even in case of division by zero.
    36. == gives compiler error if the operands are cast-incompatible.
    37. You can never cast objects of sibling classes( sharing the same parent ), even with an explicit cast.
    38. .equals() returns false if the object types are different. It does not raise a compiler error.
    39. No inner class can have a static member.
    40. File class has NO methods to deal with the contents of the file.
    41. InputStream and OutputStream are abstract classes, while DataInput and DataOutput are interfaces.

GetJava Download Button

  Other Searches With Google
Google