A) You can not restart a dead thread B) You get an ArrayIndexOutOfBoundsException when you attempt to access an array element outside the size of the array. Cheers!
Hi all, whilst studying for the SCJP, I would like to ask is there a specific list of Runtime errors? For example: A) Restarting a dead thread B) Attempt to access an array element outside the size of the array? Thank you Tony
[ February 03, 2003: Message edited by: Roan Nicolas ]
Hei, Yeah, they're a bit tougher compared to the real exams but they will help a lot since you can learn so much from them. I know they can be quite confusing but once you've understand them you'll make it through the real exam! Kippis!
Hi Steve, If you would check your voucher it is indicated there that it is for the 310 exam. This means that you may take the 310-025 (SCJP 1.2) or 310-035 (SCJP 1.4) using it. You just have to specify to the training center which specific exam are you going to take before you schedule it. Hope that makes sense.
Just cleared SCJP 1.4 yesterday. The level of difficulty on Marcus Green's mock exam is "as close as it gets" with the real exam. Thanks to everybody who helped me with my review questions especially to Anthony Villanueva, Vladimir Naval, Dan Chisholm and Kathy Sierra. I would also like to thank everybody in this site for participating in forum. Keep up the great work guys!
Hi Rui, Remember the super() construct leads to chaining of subclass constructors to superclass constructors. This means that a subclass must call the constructor of its superclass. This chaining behavior guarantees that all superclass constructors are called starting from the Object class, followed by the constructors in the other classes down to the class being instantiated. This is called (subclass-superclass) constructor chaining. If a constructor does not have an explicit call to super(), then the call super() (without the parameters) is implicitly inserted to invoke the default constructor of the superclass. If a class only defines non-default constructors (i.e. only constructors with parameters) then its subclasses cannot rely on the implicit behavior of a super() call being inserted. Subclasses must then explicitly call a superclass constructor, using the super() construct with the right arguments. In your case: class par{ par(int i){} } class chi extends par{ chi(){ super(5) //insert this code } Hope that makes sense }
I tried reproducing your problem and I was able to compile my classes. You may want to check for typo and if the .class file itself is present in the working directory. You could trying posting your exact code so we could compile it ourselves. Hope that makes sense.
Hi Danny, I just tried the test and it was really challenging. I'm also reviewing for SCJP 1.4. I thought I was prepared since I've already finish Mughal's book but upon taking LANWrights Test I decided to postpone my test for next year.
Hi Danny, I agree with Valentine. There is really no difference in terms of construct and initialization between the two array statements: int [] x = {1, 2, 3}; int [] x = new int[] {1, 2, 3}; But the primary purpose of the new int[] {1, 2, 3} is for anonymous array since you can create it without declaring an array name. Also, int [] x = new int[] {1, 2, 3}; // will NOT give compile-time error Hope that makes sense.
Hi Fellow Ranchers! First of all, I would to thank everyone who have contributed to this forum. I'm on the process of studying for my SCJP and I'm really learn a lot from the different topics posted here. Anyway, I have a question with regards to one of Dan's Mock Exam Question on Garbage Collection. Question 1:
After method m1 returns the objects on which of the following lines are eligible for garbage collection? a. 1 b. 2 c. 3 d. 4 e. None of the above. f. Compiler error. g. Run time error. h. None of the above. Question 2:
After method m1 returns the objects on which of the following lines are eligible for garbage collection? a. 1 b. 2 c. 3 d. 4 e. None of the above. f. Compiler error. g. Run time error. h. None of the above. I believe the answer to Question 1 is letter E and the answer to Question 2 is letter B, C, D. My question is how come when the reference of the array is set to null (Question 1), it is not eligible for garbage collection but if its elements were set to null (Question 2) then they would be eligible? Is this really how the garbage collection works? Thanks
D. An anonymous inner class can access final variables in any enclosing scope Basically an anonymous class have direct access to all members in the enclosing context whether they are declared as final or not. In the case of local method variables, since the anonymous object can continue to exist longer than local method variables, the anonymous object is not permitted to access local method variables unless the variable is declared final and is assigned a value before the declaration of the local or anonymous class. The JVM can place a copy of the value of the final variable directly into the local or anonymous class so there is no further dependence on the method variable. Hope that makes sense. [ November 27, 2002: Message edited by: Roan Nicolas ]
Basically, start() method causes the thread to begin execution. The Java Virtual Machine however calls the run method implemented in the thread. Hope that makes sense. [ November 21, 2002: Message edited by: Roan Nicolas ]
When a variable of an object (billType) is accessed using a reference, it is the type of reference (Light), not the class of the current object (TubeLight) that determines which variable will actually be accessed. Hope that makes sense.