Help coderanch get a
new server
by contributing to the fundraiser

sreenivasa reddy

Greenhorn
+ Follow
since May 04, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by sreenivasa reddy

If a class access specfier is default i.e if the class is visible only in the package, then why are the members allowed to have public as access specifier, any way the class will not be available in other packages.so,the members even though public will be visible only in that package
suppose say there are two methods in a class with same name
ex:
public void callme(Child c){
}
public void callme(Parent p) {
}

in the client i invoke the method with Child object

callme(childObject);

then the callme(Child c) will be invoked, as the other method parameter is parent class variable, the childObject can be taken by that method.

how does the compiler differentiate between two?
can a class be sub class of itself, if s how is it?
why is it not allowed to define static methods in non static inner classes, when final static variables are allowed?. what is the problem in allowing this......any one can explain please.
when u try to instantiate a string object, it will initially search for a object in the pool with same value. if no object is found then it will create one for u and returns that object reference, if there is some object already in the pool, it will retur the reference of the same object.
so for the code u mentioned there are two reference variables pointing to one object.as, some reference is pointing to the object, no object is free, so no garbage collection.
when a static inner class has private as access specifier, then it should have enclosing object, but for static inner classes there is no need for enclosing object.