hi Ranchers,
one good link:
http://www.4tests.com/exams/examdetail.asp?eid=61 sm thngs to remember its from a Certification gp ... we jotted down all these during our preparation; .....hope u all will find it helpful:
JavaTechnicals 7/6/2004 4:34 AM
hi All,
i think it wud be better from my side to create a new thread for Technical discussion/dbouts on Java(a no for JCP).
happy Javing edit
Navneet Java Basics/Tips 7/6/2004 6:13 AM
1. all FLOATING pt var are assumed to be Double
2. all ARRAY elements are ALWAYS initialized with default values, whether its class,
reference, or local var.
3. we cannaot convert a CHAR to SHORT implicitly/automatically.
although they are of same size, but since chars are unsigned it may hold a higher
+ve value than a SHORT can hold.
4. Floating pt./ Double numbers dont give divide by ZERO exception on compile/run time, on being divided by Zero.
INSTEAD they give NaN(Not a Number) as result.
===Navneet edit
delete
Ravinder Some More Basic Tips 7/6/2004 7:25 AM
1. Private member of super class can not be overridden in subclass, but it can br redeclared/redefined in subclass. It aslo means that polymorphism does not apply.
2. The result of an airthmatic is always at least 'int'.
3. The == operator look ONLY for a match of bits. For two different objects, the only way == can be true is if both the reference variables point to same object.
4. You cannot compare a boolean to an integer in 'JAVA' but in 'C' it is possible.
5. Class defined within an parameter to a method is 'anonymous'.
delete
Navneet SwitchCase 7/7/2004 3:31 AM
in SwitchCase, statement execution continues from the line
where matching case is found.
Execution continues for all cases untill & unless a break is encounterd. edit
delete
Ravinder Tips 7/12/2004 3:33 AM
Bitwise
When you shift a bit by a numeric value greater than the size in bits, Java does a modulas shift.
For Example:-
result = 5 << 9 ;
Java shift this by 9%8 or 1 i.e now result = 5 << 1.
boolean
The language specification does not state the actual size of the boolean. It take one bit to represent the two values, but the JVM can use whatever size it wants to store the value.
delete
Ravinder 7/20/2004 1:18 AM
java.lang.Math
java.lang.Math is a final class and thus cannot be subclassed. Hence following declartion is invalid.
public class abc extends java.lang.Math {}
Garbage Collection
The developer cannnot force garbage collection by calling System.gc();
delete
Navneet JavaTechnicals 8/14/2004 8:33 AM
1) >>> always give a positive output
2) we can have a private constructor
3) we can have a any no. of top level classes within a source file, BUT only one can be declared as PUBLIC.
4) default constructor is NOT aways coderanch. It is public if class is also public else it is given a default constr.
5) OVERLOADED methods are allowed to change the modifier as these are not being taken into account while checked for signatures.
6) PROTECTED access modifier is only for member variables, not for class.
7) Math.round() always returns a int value
8) An ABSTRACT class can have a constr. Since it cant be instantiated we cant make a direct call to the same.
However it will be called implicitly by constr of the class extending it
9) >> always give a negative output
10) I feel rest shud be left for others... cm on dropin sm tips... knowledge shared is growth edit
delete
Ravinder Some important facts about Inner classes 8/27/2004 4:04 AM
TOP-LEVEL Class/Normal Class
1. Top-Level class can be declared as abstract, final and coderanch. Private, protected and static are prohibited.
2. A source code can have more than one top-level class, but only have a single 'public' top-level class.
3. An abstract class can have a constructor. It's implementation should be provided to it.
NESTED TOP-LEVEL Classes/Interface
1. These class/interfaces are defined inside a Top-Level class.
2. Are always defined with 'static' access keyword.
3. As they are static, hence can be accessed and intiated without any instance of the top-level class(enclosing class).
4. Since declared static, it can only access static members of the top-level class.
5. Nested top level class cannot have the same name as top-level class.
6. There is no such thing as Inner interface. As the interfaces are 'static' hence are always top-level one.
INNER Classes
1. An Inner class is always defined inside a outer class.
2. These classes are always instantiated in context with outer class i.e requires an instance of outer class.
3. Inner classes can have coderanch, protected, public and no access specifer, but it cannot have 'static' modifier.
4. These classes can extend or implement any class or interface.
5. Member classes(inner or non-static classes) require an instance of enclosing class and every instance of member class holds an implicit reference of enclosing class.
6. Member classes cannot have static members unless it has compile time constant.
7. Compile Time constant - defined as 'static final'. Ex: static final int x = 10;
8. Member class can be declared as coderanch, protected, private, abstract, final or static.
9. Member class can access all the members,including private, of its enclosing class.
Continue....
delete
Ravinder 8/27/2004 4:05 AM
LOCAL Classes
1. A local class can be defined inside a method, constructor, static initializer and instance initializer.
2. A local class cannot have a static modifier.
3. You cannot use coderanch, protected, private and static inside local class.
4. A local class can access all the variable and methods from its enclosing class, but can only access 'final' modifiers declared inside a method.
5. Local class cannot be access from outside the method.
6. A local class cannot have static modifier, but can be declared inside a static context i.e static method.
delete
Navneet Mistakes I made 9/8/2004 1:50 AM
hi all .. i jot down few mistakes i made during my preparation for JCP... will add more to it. hope u all may find it helpful
==== Mistakes I Made ----
volatile is a keywrd in JAVA
Q was askeds for BYTES not BITS; 64bits = 8 bytes
asked for correct options NOT incorrect
Read Q/ options carefully
This way we can overload the method// during method over-load/rid-ing, we can change the args list... it is exactly OVERLOADING
Brush Up with Threads, and note down what is OS dependent behaviours
Math.round() returns int & long ; int for int/float & long for long/double
The method size() returns the number of characters.
Please note that strictfp is a new keyword in Java 2
Best of luck & hardship to all aspirants!
Thanks
nav