Phone Myat Kyaw

Ranch Hand
+ Follow
since Dec 26, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Phone Myat Kyaw

Hi bro, are you burmese ?
To buy the voucher, just directly go to Sun Java Singapore website. Now they are giving a promotion that give you a free 2nd shot if you happen to fail the first time.
I'm going to sit for the SCJP 6.0 tomorrow try keeping up bro.
oh nvm, just my stupid careless mistake.

Because of inheritance, Woop also has Hmpf.

Sorry for my post(happened to be spam)
Hi, I'm going to sit the SCJP 6.0 exam tomorrow and I'm doing my final preparation. Here's one question make me confusing.

1. class Zing {
2. Hmpf h;
3. }
4. class Woop extends Zing{}
5. class Hmpf { Zing z; }
Which is true? (Choose all that apply.)

Answers are
Zing has-a Hmpf and Woop is-a Zing.
Hmpf has-a Zing and Woop has-a Hmpf.

I completely understand the first one - Zing class has a Hmpf ref while Woop is inherited from Zing.
But I don't understand why the second answer is correct. What I see is, the first part, Hmpf has-a Zing, is true
but the latter is not. But the mock test I'm taking (from the K&B book) give both are correct.

Can someone explain me in a bit more detail?
thanks for your advice, Nitish

Now I can figure out why the strange things are happening, reason is accessing static variable from non-static method (here, constructor) and two instances (Thread Two).

Phew, cos of my SCJP Book, K&B, the best advice for threads sync is

Access static variables from static method and access non-static variables from non-static method.
Hi, I'm getting confused whether synchronizing on static variables blocks have been actually blocked.

What I understand is for static methods, we only need one lock per class. But for blocks of static variables like above ? Is it same as static methods ?

thanks in advance
thanks Rob Prime, thanks for your explanation.

12 years ago

I'm studying the Thread area for the SCJP 6.0 exam and got a question that what is the difference between run() and start() of a thread instance? Are the both ways getting a new stack of thread ? For start(), what I understand is, the thread becomes runnable state, but how is run() ? Is it running directly on top of main thread like calling a method of its own or creating a new stack ?

Both gave me nothing wrong and I just wanna check how it's different. But when I changed the style (implements Runnable), the class cannot invoke start() (this is understandable) but still can invoke run(). Does it make a new stack of thread or on top of the main thread ?
12 years ago

Jason Irwin wrote:Just tried with Eclipse Ganymede using Java 1.6.0_14 on Ubuntu and it does not compile.

I get the exact same error as Mike.

Have you tried compiling from the command line/terminal? Perhaps NetBeans is suppressing a warning and you are not running the class you think you are running.

Hi Jason, you are absolutely correct, as I've tried in cmd and get the same error.
Hmm, why NetBeans is not giving such error ? Is it like NetBeans is not as reliable as Eclipse or am I missing something?

For the thing you said that it's not the class that I think it's, could not be. Because it's showing other parts of the program and so, I'm pretty sure it's as what it should be. In fact, I'm just doing as a practice myself for my SCJP 6 exam which is on 14th next month, studying the Inner Class related question using "SCJP 6 Study Guide by Kathy Sierra & Bert Bates". This is my full code for the whole program.

anyway, thanks a lot to you guys
really appreciate your very fast and helpful response + advice
12 years ago

some mysterious thing occurs ? I use NetBeans 6.7 and Java 1.6.0_13 on Mac. I swear by god that I never change, just compile and get this successful message.
12 years ago

Sebastian Janisch wrote:Local variables cannot be abstract. The only modifier allowed for local variables is final

As a matter of fact, the abstract abstract modifier is used for classes or methods respectively, not for variables.

Hi, thanks for your quick response, but local variables certainly can be abstract.

That's why I'm wondering why it's allowed, no idea how it's useful in what situation except abstract class/method
12 years ago
Hi, I'm truly sorry if my question has been answered already, but that thing just came into my mind.

As the topic, what is the main purpose for allowing local variables as abstract ? Is it just solely for abstract class/method so that programmers can leave such variables with no initialization ?

What I understand is, instance variables are automatically assigned to default values if no initialization but for local, we must declare their values explicitly. So, the main purpose for local can be abstract is, just for abstract class/method or is there other reasons ?

12 years ago
Thanks for your quick response
I'll try second time to finish up the HTP book after the exam.

appreciate your wish
best rgds
12 years ago
Hi all,

I'm going to take SCJP 6.0 exam in the mid of next month and after that if I pass, as I'm still in my uni second last sem, I'm willing my knowledge to expand in GUI part. I have searched through at and book reviews here to get a good solid foundation book on GUI and got a bit confused about which one would be best for a java programmer but quite new for graphical era.

For you to guess my level, I have done some basic GUI programming and the books I've studied so far are:
Head First: Java (2nd Edition)
Java: How to Program (6th edition) - give up on half-way as too deep and lengthy explanation
and school works + some online tutorials

Can you please share your opinion about which book trail would be fast pace and best suited for me ?
12 years ago
Hi everyone...

I'm gonna take the SCJP 6.0 Exam in next month (during my uni sem break before my undergrads last sem starts).
I'm currently studying SCJP 6.0 Exam Study Guide by Sierra Bates which is, so far, the best book for me - easy to follow, clear explanation and invaluable advices for careless mistakes. This is the only book I've been reading so far.

Can someone give me links for online resources, books, or your opinions for the exam ?