luco zhao

Ranch Hand
+ Follow
since Apr 23, 2002
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 luco zhao

Hi, there,
I've got "java.lang.IllegalStateException: Unable to access thread pool due to java.lang.NullPointerException" error info when use org.apache.avalon.excalibur.thread.impl package to manage thread pool.

How to use the package, I got no idea about the exception described above. Thanks in advance!

Originally posted by john guthrie:
we just started using the jakarta-commons object pool for JDBC connection pooling, and plan to do the same for threads. it's just an object pooler, but so far it seems nice and lightweight.



Actually, there are
org.apache.avalon.excalibur.thread
org.apache.avalon.excalibur.thread.impl
packages available in scratchpad.jar, but do you how to use this thread-pool impl? thanks a lot.
Hi folks,
I got one question on evaluation order

Why and what's the difference bt below code?

Could anyone here help me out?Thanks a lot.
Hi there,
I've got a question about HashSet, first of all, please see my testing code, then I will give a short explaination of the problem.

As no duplicated elements allowed in Set, how to implement it? Thanks

Originally posted by Rob Petterson:
Therefore it will be legal at compile time....but NOT at runtime??
Is that right?


NOT ALWAYS, as there is a runtime check.

Originally posted by Rob Petterson:
class B extends A {
A a1 = new B();
b b1 = new B();
b1 = (B)a1;
}
Will the above code always compile but sometimes not run?
Also, can someone explain what 'casting down the tree means'. Is it the above?


Let me try to answer it.
The code above will not compile as there is not a class named b.
If that is typo error, you can compile and run it well.
To know "casting down the tree", you should know a little about Java hierarchy is a inverted tree structure, i.e. parent class stays upside, and its child or grand-child or more will stay downside the tree.
So when saying "casting down", it means that you cast from a parent class to its child, it is not safe anyway.
By the way, upcasting goes the opposite way, so it is safe.

-write() method of InputStream.


write()?
read(), right?
Hi Tosin,
Could you do a search please, there should be many good threads on your questions.
I learn that List interface owns LinkedList, ArrayList implementing classes, but I am not sure their diff and when to use one of them? Could someone give kind hints here? thx.

Originally posted by Tosin Adedoyin:
class Mock
{
public static void main(String args[]) {
StringBuffer sb1 = new StringBuffer("Amit");
StringBuffer sb2= new StringBuffer("Amit");
String ss1 = "Amit";
System.out.println(sb1==sb2);
System.out.println(sb1.equals(sb2)); // line 2
System.out.println(sb1.equals(ss1));
System.out.println("Poddar".substring(3));
}
}
why does line 2 print false instead of True


Because StringBuffer class doesn't override equals() method, not expected as String class which overrides equals() method.

Originally posted by Corey McGlone:
Notice, however, that the fact that the method invocation is ambiguous is dependent upon the fact that the test method is overridden in class Sub. Try commenting out that overriding method and see what happens.
Corey



Yup, Corey is absolutely right. But could you please tell me the reason?
I've just done the following test, and it works without inheritence.
Hi folks,
I just read this question from our school BBS, could anybody give me some kind help?


Using println on a null object will never cause a null because the println method checks to see if the object is null before it runs the objects toString() method


Paul is right.
System.out.println(null) is ok.

Originally posted by Abdul Latif:
hi guys i have completed my programming certification but still out of job.I think so the programming level is only the first step.i am planning for exploring java in depth like going for enterprise java bean, the developer exam, & then for java arcitechure please anyone who has knowledge about these plaese help me out & then please frankly say is there it worth doing java in depth because people say java is now no more plaese help me


It depends, I am with a IT firm currently without a PROGRAMMER CERT.
But actually, more certs will do better than none. So I often haunt here for learning sth from Corey, Rob, and other masters of Java :-)
21 years ago
I don't know why, but notice "dir *" works in command prompt.