|
|
Re: Any Java Source for 16 questions
|
Posted: Mar 9, 2006 10:53 PM
|
|
Well, would you actually TRY to do something wrong, most of the questions would be abvious.
So I give you SOME answers, but for most I give you a hint how to find the answers
1 Just try it 2 Just try it 3t you can override anything public or protected 4 What if a class extending B was assigned to b and this class overrides the method? 5 Just try it, put the static method in the same class where the private variables are 6 May be I don'T undertand this right, but try to create a class inside a class 7t Trick questions: You can do this in the same program line, but during runtime they are created before calling the super constructor, but initialized after calling the super constructor. Since most people don't know this, the answer is T 8 primitive variables do (they are set to 0), Object variables don't. The compiler will give you an error for primitives, too. So the answer is T. 9 Try to use the "extends" tag in the headerr listing 2 classes 10 Try to use the "implents" tag in the header for 2 interfaces 11 What about inner classes? For 2 independent classes: Depends on the class loader. Try to do this with the default class loader (create 2 classes in one file and try to compile it) 12 I assume it's thrue that you can only add 2^16 or 2^32 elements, but you will never encounter this barrier. For 14 and 15 look in the chapter about constructors. For 16 look in the chapter about "extending classess"
|
|