Raju Champaklal wrote:this code compiles.....but the code below this doesnt....why? and whats same erasure?
Prasad Kharkar wrote:@Anchit
it it true that we cannot instantiate abstract classes
but the abstract class constructor is called when a subclass of abstract class is instantiated
this is because constructor has implicit call to super constructor
Devaka Cooray wrote:There are several chapter-wise mock tests listed in ScjpFaq
Henry Wong wrote:
Anyway, to answer this question. Sure, it is perfectly valid to have a private constructor in an abstract class. I can think of a few ways that it can be invoked. For example, there is another constructor in the abstract class that calls this one. Or there is a static factory method that can be invoked -- that creates an anonymous inner class. Or there is actually a nested concrete class that inherits from the abstract class.
Henry
Henry Wong wrote:
If you really want to, I guess you can get the source code for the JVM from open source. Google for "openjdk".
Be warn though, the code is complex. And written mostly in C and C++.
Henry
Prasad Kharkar wrote:Whenever we are calling println method
then all the stuff that we are printing in it is calculated or executed first
see the code for explanation...
...
Hope this helps
happy preparation
Seema Kekre wrote:
Anchit Herredia wrote:
In other words any class extending Uber will be able to use y as its own member. .
This is partially correct. Any class extending Uber in the same package can use its default members as its own, static or non-static.
Edit: Highlighting as its ownto be clear
Joanne Neal wrote:
Anchit Herredia wrote:2) There has to be at least 1 public class in trial1.java. This is because each source file must contain at least 1 public class.
This is wrong. A source file does not need to contain a public class but if it does there can be only one.
Rohit Varma wrote:Thanks Rene and Anchit.
I scored 90% marks.Ankit, I prepared for around 3 months and it was about 2-3 hours a day.
I gave ExamLab exam and K&B mock exams. Well, the scores were very depressing,but learn a lot from them.
Best of luck for your exam. By the way , this forum rocks![]()
Henry Wong wrote:
Keep in mind that inherited doesn't mean that the sub class gets a copy of the method, it calls the super's version of the method.
And in the Exam class -- the display() method is part of that class; compiled with the class; and from the point of that method, the "this" reference is of type Exam. And since polymorphism doesn't apply to instance variables, it will get the Exam version.
Henry