Ken Lai

Ranch Hand
+ Follow
since Aug 06, 2000
Merit badge: grant badges
For More
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 Ken Lai

Bah, I paid $250 for the assignment so I'm pretty sure I don't want it to be over in one month, let alone one week, or one day!

Originally posted by james gong:
A class which has all its constructors declared as private
1.Cannot be instantiated by any other class.
2.Cannot be extended.
3.Both i and ii.
4.has to be declared final.
key is ;2

Sounds right to me.
Notice that answer 1 doesn't specify whether the other class is inside or outside the class with the private constructor. Please take a look at the code below and let me know what you think (I don't really know what would be the use of similar code though).

class Ex
public static void main(String args[])
Ex.SubEx sx = new Ex().new SubEx();

private Ex(){}
class SubEx
{ new Ex() ;
void method()
}//class SubEx

[This message has been edited by Ken Lai (edited August 10, 2001).]
Having done 1.5 years of SAS/JCL/SQL stuff, I recently moved from the mainframe environment to a java based architecture within the same firm.
Although it's not exactly what I thought it'd be (it's more like web site customization & debugging rather than app development). it's heck of a lot more stuff to learn from, with more docs on problems/solutions, which I enjoy most.
Bottom line, if your company is/will be moving from mainframe to to web/client server based architecture ask around and see if they will be needing more people. Networking works wonders I tell you (though I didn't get the job with this).
22 years ago
If you still have this problem, please take a look at your bean and see if it's missing a default constructor. I'm just suggesting what my VAJ book (from Scott Stanchfield) says: when you drop a bean in a free-form surface and the bean doesn't have a defaul constructor VCE might fail.
Also, you can turn on the system programs debugging mode by checking the Window->Option->Coding->Debugging->"show system programs in debugger and console" to see what's going on.
I'm not too sure if it's a bug or if it's something not working since I haven't really used the IDE to connect to servers, but do check out the readme file of patch #2 and see if there's anything familiar with your problem. The patch contains lots of fixes so it might help.
Whoa! This thread lasted for like 2+ years!
Anyway, unless one already knows how to use an IDE, using an IDE to learn the Java programming language (any language in fact) would actually make the learning process less effective for the following reasons (that I can think of):
- There's always a learning curve for IDEs (as if learning the language itself is not confusing enough?)
- IDEs do lots of things to help you, either by creating more code that you might not be able to understand, or
- IDEs may force you to code in one way or another (may narrow your view about the language)
- IDEs do more for you (such as automatic get/set method generation for the fields you create, or the automatic implementation of abstract methods/interfaces done for you when you extend abstract classes or implement interfaces), but do you know why they do those things for you? At this point you might have to stop your reading about variable scope and go to later chapters to find out why those methods are implemented/created for you, which may even further confuse you!
- Whoa I can just draw GUI objects and the IDE will just generate the code, cool! Well, what if you're looking at some code that have been previously created by someone? Now what? Do you know why it's generated that way? Is it because of how your IDE is designed to create the code or is it because of the language limitations?
Well that's all I can think of, but I do understand there are some benefits to using IDEs, such as:
- IDEs allow you to look at the states of the variables of your code and allow you to see what's happening in real time! (well, sort of)
- Some IDEs allow you to look at library codes and browse the class hierarchy very easily, this may help you to understand how the classes work as a whole
Bottom line, once you know the whats, hows, and whys of a programming language, IDEs will work wonders for you. But to learn an IDE on top of a programming language might slow down your learning.
[This message has been edited by Ken Lai (edited May 29, 2001).]
I see a lot of discouraged SCJP's here and I've personally benefited from Javaranch's discussion forums so I feel obligated to share my story with you.
I spent 3 months studying by myself and eventually got certified in August of year 2000 (yes, about a year ago). I thought it'd be easy for me to get a job since I got certified, but I was a bit disappointed after a while because I don't have the "work experience". Sounds familiar?
After doing lots of searching and follow-ups within the same company I've been with, I finally got some interviews and was offered a job as an entry level Java worker (they have some really nice title for it, but I don't believe the title applies to what I will be doing so I won't use it here). I'll be spending most of my time debugging Java/XML code, which I don't have a problem with since that's at least some sort of Java work.
That's about it for my story. Yes it's short, but my experience looking for a Java position taught me a few things:
- It's never gonna be easy, especially if you aren't currently working with Java. It took me 3 months of 5-hour nights and after being certified another 8 months to get a Java position, and that's within the same company!
- It might not be what exactly I wanted to do, but it's one step closer
- No matter what you think, going through the certification does have its benefits. I view it as an opportunity to really understand the language. It felt so good to be confident in a technical interview and be able to clearly explain what you know about Java, it makes you eager to get more questions from the interviewer!
Bottom line - Don't give up!
23 years ago
Thanks guys!!!
I want to thank everyone who created, manage, and visit Javaranch. I'll stick around to help out others as well as learn from you guys (believe it or not, a lot of questions posted are harder than the real thing in terms of understanding the details of the language).
Well, to all of you who are preparing for the exam, especially the newbies (I'm still one!!), good luck!! If you prepare well, you will pass!!!
<H1>Javaranch Rules!!!</H1>
My test experience:
I went there early (like an hour early) and started the exam about 15 minutes before the scheduled time.
The questions, especially the first few, were language tests. Those questions were ambiguous, especially for a non-native speaker like me. Being a 3-month-old Java newbie it took me really long time to answer each question. By the time I got done with the 1st pass there were only 30 minutes left! Then I went back to check the marked questions (I had 22 of those!!!). Time really flew during those 30 minutes because when I was checking the 18th marked question I got a "Your time is up" message!!!
I was horrified. It was brutal. It's true, those were the longest ten seconds of my life!! I thought to myself: "Be prepared to work on it for another 2 weeks coz you failed!"
Then I got 2 surprises:
1) I passed!!
2) I got 90%!!!
Sorry, I can't remember the distribution of topics as I was focusing on the test too much. There were more AWT and events questions than I expected (and they require some understanding of the return type and some method of AWTEvent objects), but the rest were pretty well balanced I think.
Even though I passed, I feel guilty for not preparing myself enough because there were some questions I could have answered better (==no guessing) if I did more research on those.
My 1 and only Advice:
abstract and synchronized (in case of method declarations)
abstract and private (because an abstract method needs to be overriden)
[This message has been edited by Ken Lai (edited August 13, 2000).]
First of all if a method is overriden, then the actual object determines which method is called. In this case the actual object is B.
Note there are cases where m() in B will NOT be called:
1) m() is not overriden (this is obvious)
2) m() is declared as private in class A
Warning: This is just based on my observation, those who really know the language in and out please correct/confirm. Thanks.
I think giveBirth(A a) is not overriden since the parameter list is different than giveBirth(B b), so my guess is that there are actually 2 methods (giveBirth(A) and giveBirth(B)) in class B (the 1st one is inherited).
Now here's my question. When a call to giveBirth() has been made with a reference of type A.
A a = new A();
Which method do you think the compiler/JVM would choose? Again, my guess is that the giveBirth(A a) is chosen, hence the output "Y"
Can any JLS experts (I know I'm not ) tell us something about this?
This is tricky because even though f() is private the code was able to call it through the inherited g() method. Is there a valid reason for this?
[This message has been edited by Ken Lai (edited August 13, 2000).]
Try this:
class Outer
class Inner

class SubOfInner extends Outer.Inner
SubOfInner(Outer o)
To create an instance of SubOfInner use this:
SubOfInner soi = new SubOfInner(new Outer());
One word: Ugly!!!
new Extension()
is an anonymous object created within the parameter of the bogo() method . The reference is b within the bogo method. Yes you can create an object without giving it a reference. Try this:
class Test
public static void main(String[] args)
new Test().print();

void print()
{System.out.println("Method invoked");}
This is the same as:

class Test
public static void main(String[] args)
Test t = new Test();

void print()
{System.out.println("Method invoked");}
hope this helps.