Jason Li

Ranch Hand
+ Follow
since Jun 24, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jason Li

Hi, Marcus,
Do you remember last time i sent your email to discuss your Mock1 question 19 and then you update the answer? Question 19 is really a good question.

Here i suggest you add another question based on Q19. At what circumstance will it guarantee the answer 4 blar blar 1 2 3 4?

i don't know if the program i wrote in my email will guarantee. But Q19 gives me some light so i didn't hesitate a second to select the answer.
Thank you for your great mock again!
Jason
22 years ago
Hi,
"if" is special, if the boolean expression is compile constant, "true" or "false", and there are some code in the "if" block which are unreachable, the java compile think this is normal. The reason is specially for conditional compiling for debug. But for "while" and "for" statement, if boolean expression is compile constant and there are some code in the block which are unreachable, compile error occurs. Read JSL.
Hi, polymorphism has nothing to do with memory. But the jvm will maintain a table where overridden mehtod will be bound at runtime according to this table. The table is updated when the jvm loads every new class if there is an overridden method in it. Hope this helps.
Jason
SCJP2
When you register in the test center, you should have written down your address in the register form. Sun will use the address that test center supplies. i passed the exam July 27 and yesterday i got my certificate. But i don't know how to trace my record in Sun's web database. Can sb. throws a light?
Jason
SCJP2
22 years ago
Yes, same as using in visual basic.
22 years ago
I have at least two inner class combined with thread problems. And i was distracted by thread because i paid too much attention to it and ingored to check if there is any problem related inner. And i was trapped. My suggestion is you should be very careful about this kinds of questions.
Jason
Yes, i know what you mean. But private method doesn't take part in overriding, and we can't call the private method in other classes. Even if the object referenced by "obj" is type Derived, the compiler solve the dynamic binding by the reference type, not by the real object. In this case, the compiler only see a private method, it doesn't know anything about dynamic binding of the method in Base. The only thing compiler knows at Derived is there is no named "amethod" in Base which is visible. That's the reason you got the complain.
Jason
Interface doesn't extend Object. The reason the code you posted can be compiled is that the compiler assumes the object referenced by "obj" will implement the Runnable. If not, you will get runtime exception. In fact, you can "cast" any no-final class to an interface without compiling error, but doesn't guarrente you won't get runtime exception.
Jason
SCJP2
Hi, i can recall one mistake i made in thread question. So your guys pay more attention to thread and inner, especially the combination. i was distracted by thread and ingored the inner.
Good luck!
22 years ago
That's the point. Reference "b" is a Base type, out of class Base, "b" doesn't know anything about a method named "amethod". So by "b" you can't call the mehtod. That's what the compiler thinks.
Jason.
Yes, you are right. In another class, private method is invisible . And private method doesn't join in overriding. So reference "b" doesn't know anything about the public method in Derived class which happens to have same name as the Base class. Hope it helps
Jason
Hi, pals,
i passed the scjp2 an hour ago. It is pretty easy except the thread question. i did get several thread questions which is a little bit wierd and in thread part i only got 71%. And it's funny that i got several pairs of same type questions which only chang one keyword. What lesson i can tell your guys is that you need to keep cooling down at the beginning of the exam. i almost spent 2 minutes per question in my first 20 questions. But when i finished the exam, i had 55 minutes left that is enough make me checked my exam almost two rounds. And i did correct 3 questions in the first round checking. Another lesson i can tell you is that you shuold get enough sleeping before the exam day and don't touch any paper several hours before exam except resting. That helps a lot. The real exam is little bit easier than most of mock exams. i never got 94% in most of mock exams except in Mr. Green's. Definitely you will get the same score in real exam as which you get in first taking Mr. Green's exam. Thank all the people who made the mock exams freely available in the web.
Jason
22 years ago
Don't you guys think the example which manfred gave are created inside a method? The other place only get the return value which is created in the method. Why B is not the answer is because we can create anonymous class inside a class but out of any method ---in Initializer or Initializer block. So i think answer should be A, D.
Jason
[This message has been edited by Jason Li (edited July 26, 2001).]
Hi, wei luo,
For your first question, you can't pass any instance variable to this(), i guess also super(). Please see JLS 8.8.5.1.
Question 2, yes, y r right.
For any checked exception, we must throw it, then catch it. But not for runtime exception.
For initializer, please read JLS 12.4 and 12.5. That's the best with examples.
when you declare int[] ... in a line with ",", all the variables are array. In this question, d is an array of array. And in deed, you can have a array with 0 element.
hope it helps.
By the way, when did i become a ranch hand?