SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
SCJP 6
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
SCJP6 with score 90%. I am conscious of my ignorance and ready to learn from everyone.
Prasad Kharkar wrote:
what I wanted to ask is following
1.how the method getA() and getB() get called, I mean we are not using any object for that and also they are not static methods
2.Also the block containing the System.out.println("Parent class instance initializer ") statement is an initialization block isn't it? then how does it get called even if it is not static?
3.Is it related to the object creation? but I don't think so because it does not come with the constructor tree isn't it? I'm really confused.Please help in this matter
...However, prior to execution of the constructor, we execute instance initializers and member initializers - in order, from top down. That means that the next line we are going to execute is:
int a = getA();
SCJP 6
SCJP 6
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Prasad Kharkar wrote: ... Here the getA() is the method and how does it get called without even calling it by an object ?
SCJP 6
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Consider Paul's rocket mass heater. |