Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

mohamed hamdy

Ranch Hand
+ Follow
since Feb 13, 2003
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 mohamed hamdy

hi, Amila . taking the test was a part of a schoolarship , and they orgaanized that we take SCJP1.2.
19 years ago
thanks for all of you ranchers.
19 years ago

Assume the above main method is invoked using the following
command line.
java X A B C D E F

What is the result of attempting to compile and run the program using the specified command line?
a. Prints: ABCDE
b. Prints: BCDEF
c. Prints: ABCDEF
d. Compile-time error
e. Run-time exception
f. None of the Above
the answer is e, but i think that the answer is b,e since BCDEF will be printed befor the runtime exception raised.
thanks Corey , thanks Param
what will be the output when compiling and running this code?

the answer is "fail to compile", it made sense for me since the condition in the for loop will be false from the begining and that makes the block of the for loop unreachable, but when i compiled and run the code it gives "o" as output.
can somone emphaisis that?
Here is a method which creates a number of String objects in the course of printing a count down sequence.

When the program reaches line 6, how many of the String objects created in line 3 are eligible for garbage collection? Assume that the System.out object is not keeping a reference.
the right answer is 10.
but i think it's 11.
may someone correct me?
what will happen if a checked exception is thrown from the code of finalize() method when the object is to be garbage collected?
thanks Martin,
because the method creates a new String object that's not referrenced by the calss member sName ,
but what about the four possibilities of "0",
"0 1", "0 1 2", or "0 1 2 3" being concatenated to sName.
[ April 05, 2003: Message edited by: mohamed hamdy ]
look to this question:

1) Compile time error
2) Compilation and output of "vandeleur wiggy"
3) Compilation and output of "vandeleur wiggy 0 1 2 3"
4) Compilation and probably output of "vandelur" but possible output of "vandeleur 0 1 2 3"
the answer is 4.
why "wiggy" is execluded?
i think that there are five possibilities for the output.
[ Jess added whitespace to make the code a bit easier to read ]
[ April 05, 2003: Message edited by: Jessica Sant ]
look to this question:
Which of the following statements are true
1) An inner class may be defined as static
2) There are NO circumstances where an inner class may be defined as private
3) An anonymous class may have only one constructor
4) An inner class may extend another class
the answer is 1,4
why 2 is wrong?
lol pavally,
it's a wish that ther's someone here that also prepares for SCJP 1.4
hi Gorey
there's a question:
Under which circumstances will a thread stop?
1) The method waitforId() in class MediaTracker is called.
2) The run() method that the thread is executing ends.
3) The call to the start() method of the Thread object returns.
4) The suspend() method is called on the Thread object.
5) The wait() method is called on the Thread object.
look to this question:
Which statements concerning the effect of the statement gfx.drawRect(5, 5, 10, 10) are true, given that gfx is a reference to a valid Graphics object?
1) The rectangle drawn will have a total width of 5 pixels.
2) The rectangle drawn will have a total height of 6 pixels.
3) The rectangle drawn will have a total width of 10 pixels.
4) The rectangle drawn will have a total height of 11 pixels.
the answer is 4, but i think that the only right answer is 3 . Am i wrong?
i can add that if you change the code of constructing object as follows:
Base b=new Sub();
it'll compile and run successifully
i'm confused from the vocabulary regarding the questions about Threads is "stop" differs from "stop executing" ?
and does it means the thread becomes dead or blocked ( can run again ) ?