Author Topic:   constructor problem
Mike
unregistered
posted February 21, 2000 05:12 AM           
Just looking at Robert&Heller Cert Study Guide and
found the following:-
Is it true you can have
1) final constuctor
2) abstract constuctor
3) native constructor
4) synchronized constructor
I dont understand why any of the above can be true.

Jim Yingst
sheriff
posted February 21, 2000 12:29 PM             
Roberts/Heller/Ernest are wrong again - none of these are legal. I assume you're looking at page 91? The column labeled "Method/Constructor" should really just be labeled "Method" - then it would be OK. As it is, it's amazingly wrong. Static is another modifier they say is legal for a constructor - it isn't. This is verified in the JLS here.

maha anna
bartender
posted February 21, 2000 02:36 PM             
This is my study notes I prepared. You can refer to this.
maha anna


class test1 {}
class test2 extends test1 {}
class test3 extends test2 {}

ORDER OF EXECUTION

- static initialization for test1 done...
(init occurs in the same order as written in source.Both static vars
and static blocks are initialized)
- static initialization for test2 done...
- static initialization for test3 done...

- instance initialization for test1 done...
(init occurs in the same order as written in source.Both instance vars
and instance blocks are initialized)
- Constructor test1() called

- instance initialization for test2 done...
- Constructor test2() called

- instance initialization for test3 done...
- Constructor test3() called

KEYWORDS FOR CONSTRUCTORS

ONLY public/private/protected


KEYWORDS FOR CONSTRUCTORS

ONLY public/private/protected


KEYWORDS FOR MEMBER VARIABLES


static final public private protected transient volatile


static - OK OK OK OK OK OK

final OK - OK OK OK OK -

public OK OK - - - OK OK

private - OK - - - OK OK

protected OK OK - - - OK OK

transient OK OK OK OK OK - OK

volatile OK - OK OK OK OK -


FOR METHODS


abstract static final native synchronized public private protected

abstract- - - - - OK - OK

static - - OK OK OK OK OK OK

final - OK - OK OK OK OK OK

native - OK OK - OK OK OK OK

synchronized
- OK OK OK - OK OK OK
public
OK OK OK OK OK - - -

private - OK OK OK OK - - -

protected
OK OK OK OK OK - - -



[This message has been edited by maha anna (edited February 21, 2000).]

|