Sweekriti D

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

Recent posts by Sweekriti D

even if u instantiate from c, (o instanceof b) returns true because c is a subclass of b.
therefore option b is correct as it should be an instanceof b only, not c. try compiling the code below & then changing line 11 to
b o = new b();
and see for yourself.
1. class a
2. {}
3. class b extends a
4. {}
5. class c extends b
6. {}
7. class testing
8. {
9. public static void main(String [] args)
10. {
11. b o = new c();
12. if(o instanceof b)
13. System.out.println("instance of b");
14. }
15. }
firslty, outer classes/interfaces cannot be declared static.
secondly, methods and classes are different, i.e. even if u can have an abstract static inner class u cannot have abstract static methods. u dont ever need to give an implementation of a class as u might to a method. no problems with subclassing an abstract static class, but an abstract method is meant to be implemented somewhere - how can u justify different individual implementations of the abstract method if it is static?

[This message has been edited by Sweekriti D (edited January 25, 2001).]
static methods should not be abstract because it defeats their purpose in being either. if it is static, it pertains to a class i.e. it is a class method. if it is abstract it is meant to be implemented elsewhere in another subclass, maybe. so if u make it static and abstract, an instance of that class will never be able to access it and implement it.
if u have someone in b'lore u could ask them to buy it for u in ur name.it will be valid for a year. when u r ready for the exam, get it scheduled at the same place where u bought the coupon from.i think u could take the exam at any sylvan prometric centre if u can get it arranged there.
there is one utility definition implemented by class Object for it's subclasses and there could possibly be an overridden version in the subclass. the statement says -
"in which case the overriding definition can refer to this utility definition by the call: super.clone()"
So, if the Object class' utility version is to be accessed by the subclass, u must use super.
rat ban
consider a class as a template used to cast out objects. u use a class to combine a definition of data and methods (functions that can be carried out on that data). u can instantiate a class to form objects of that class. each of the objects that u create using say,
Object o1 = new Object();
has its own copy of data and methods of the class type it is an instance of. o1 here, is a reference to the object created by new Object(). a reference is similar to a pointer(maintained internally by JVM) to the object which u create.
the compiler probably is giving an error because it is incorrect to make a static reference to an inner class which is not STATIC or a TOP LEVEL NESTED class.
i tried
new Outer().new Inner().foo();
and got the o/p as : I am static
shikha
have u gone through any book on these operators?
which ones are u not clear on?
pls. answer so that i may be of some help.
Rani
if u see the o/p of 21/4 and 21>>2, it is identical, ie 5.
i guess it would be reasonable to mark it so, in the exam even if it is not accurate actually.
comments?
hey mukti
considering that u would like some explanation to this sample ques. i offer the following comments:
A. 12>4 // a boolean expression returning true
B. 12/4 // 3
C. 12*4 // 48
D. 12>>2 // 00000000 00000000 00000000 00000011 = 3
// 12 shifted right(>> signed right shift inserting
// 0 on shifted bits) twice which is equivalent to
// division by 2 twice i.e division by 4
E. 12/2^2 // returns 6 XORed with 2 which is 4
F. 12>>>1 // returns 6 which is 12 on unsigned right shift
//by 1 bit
therefore the Answer: B,D is correct.