hai zhang

+ Follow
since Oct 30, 2001
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 hai zhang

What is the result of compiling and executing the following code fragment:
Integer a=new Integer(5);
Integer[] numbers=new Integer[]{a,a};
java.io.ByteArrayOutputStream bOut=new java.io.ByteArrayOutputStream();
java.io.ObjectOutputStream out=new java.io.ObjectOutputStream(bOut);
catch(java.io.IOException ioe){}
java.io.ByteArrayInputStream bIn=new java.io.ByteArrayInputStream(bOut.toByteArray());
java.io.ObjectInputStream in=new java.io.ObjectInputStream(bIn);
Integer[] num=(Integer[])in.readObject();
catch(java.io.IOException ioe){}
catch(ClassNotFoundException cnfe){}
The answer is that true is print out.
Can anybody explain?
Assignment statement like line 3 should be inside a method.
Compile time error exists at compile time when you use javac to compile the program. Run time error is the error when you try to run the program using java.
Then both the int and char should be right.
Do you mean Math.random()? It returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
It includes 0.0 and doesn't include 1.0.
Which statements are true about GridBagLayout?
[a] weight x and weight y should be 0.0 and 1.0
[b] If fill is both, anchor does not make sense.
[c] It divides its territory in to an array of cells.
[d] While constructing GridBagLayout you won't tell how many rows and columns the underlying grid has.
Answer is abd. Why weight x and weight y should be 0.0 and 1.0?
What is wrong with c?
AWT components get their look and feel from?
[a] JVM drawing primitives.
[b] Peer classes
[c] Swing classes.
[d] Programmable painting support classes.
The answer is b. What are peer classes?
Which of the following statements are true?
[a] Each and every object has a lock
[b] Synchronized is used to give access to more than one Thread to access a single resource.
[c] wait()/notify() always need to call from try/catch block
[d] notifyAll() method moves all the waiting objects to Ready state
The answer is acd.
I think it should be abd.
You need to have a html file to view the applet using the appletviewer
20 years ago
You can assign an integer literal to a byte or short variable if the literal falls within the range of the variable.
The answer should be BD.
targetObject is instanceof Runnable doesn't mean it is an instance of its subclass (Thread). Every object should be an instance of Object.