hi..
following are my doubts...just clear them... i have the answer but just wana confirmation regarding them
1. If class is default ( not public ) and if its package is imported will that class will be accessible to the program which import it ? and the protected member within it ?
i think class will not be imported to other classes if its not public and if class is not accessible the there is no question of accessing its public/protected member ... Right ??
2. IF superclass reference variable is assigned to subclass object will it be able to call super class protected overloaded/overridden method/member ?
I think, in case of overloaded method as per above case only overloaded method of superclass will be called because ..when overloading method reference type is taken into a/c and in overidding case the overriding method will be called as here object type is of subclass and only those method will be called which are overridden . is i am right ?
3. what if in overloading methods one method accept
String argument and other accepts Integer object and if invoked the method will null parameter, which method will be invoked.. ?
i think the method with more specific argument will be invoked .. i think in this case String will be invoked as it more specific and inherited from class Object ?
is i am Right ?
4. while assinging to char primitive let say char a='\u15000' and char b=15000 // will same value will be stored in char primitive ?
5. if in the for loop if some statement is unreachable then why that program will not compile ? for eg. if u use continue with if statement and making code below the continue unreachable..then ..why don't it get compile..
what is the logic... ? unreachable statement should be get compile..
6. can we use throw statement within the catch block { } and if used where it will be caught...if there is next catch which can catch that thrown exception ..will that next catch block will catch the exception thrwon ...
7. i have not seen where its written that break statement can also be used to block only i.e( except loops) where continue statements can be use only in loop blocks .. where this is written in K&B ?
i face one question in khallid mughal..