+ Follow
since Jun 18, 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 cowboy55

This is based on question from marcus exam but I changed the question a little just to see what would be the output. please read and explain why your output would be true. Thanks =)
-What will be the result when you try to compile and run the following code?
public class Base{
int i = 100;
public class Pri extends Base{
static int i = 200;
public static void main(String argv[]){
Pri p = new Pri();
Thank you all for your kinda explanations.
I understand it now.
I read the following post from Steve about calculating octal and hexa from binary
"first convert any int to binary
then if it is hex you need then every four binary digits summed
represent one hex digit
int 28 bin 11100
for hex break bin into quads 0001 : 1100 this gives 0x001C
for oct break bin into trips 011 : 100 this gives 034"

Can anyone explain this method in more detail??
can u explain ur method in more detail?
What will be output from following?
1) 14
2) 0
3) 6
4) 12
Answer is 4) 12
can someone explain in easy words? (i'm not very familiar with the concept such as "octal notation" and stuff.. )
Thank you.
ps, anyone know if answer to #51 is right?
String s = "Hello";
long l = 99;
double d = 1.11;
int i = 1;
int j = 0;
which lines below would compile?
1) j=i<<s;>
2)j= i<< j;
Answeris 2 and 4
can some one explain??

Also, is this statement true?
"An interface cannot be instantiated"
thank you
Best wishes for your futre endeavors.
Please stick around and share your experty.
Thank you ppathak and herbert for your explanation. It helps me better to see what possible cases might happen that would require thread synchronization.
One question from ppathak's reply:
"hence we got to lock those objects"
what does it mean here to "lock those objects"? Can someone give more detailed explanation (if possible in relation to ppathak's scenario of one thread using the old changed variable?

Hi folks,
I'm kinda confused about the concept of synchronizing blocks/methods. Even though threads are for multitasking, don't they share the same processor? So how is it possible for threads to execute concurrently? And why we need synchronization if only one thread gets processed at a time? please correct me if i'm wrong. this concept is really confusing to me.
thanks in advance
Best wishes for your future endeavors!!
In the rules round up game #335
It says "constructors are not inherited" because "subclasses do not get a constructor from the superclass".
Can someone explain this? I thought subclasses get the "super()" constructor by default, if no constructor is given in the sub-class.
I have a question from robers&heller's certification guide.
What does it mean to assign an object reference to an interface?
For eg., consider the code below.
(Class Mammal is the super class.
Class Raccon inherits from Mammal and implements Washer.
Class SwamThing inherits from Mammal but doesn't implement Washer.)
Now here is the code.
Raccon rocky;
SwampThing pogo;
Washer w;
rocky = new Raccon();
w = rocky;
pogo = w;
After "w = rocky", doesnt "w" (interface) become an object reference to "rocky" class??
What will happen at the next line "pogo = w"? Is "w" still a an interface??
Please, somebody explain. I'd appreciate it very much.

[This message has been edited by cowboy55 (edited June 25, 2000).]
Question to Herbert:
you said,
-"So when you provide a constructor in your Xbase class you will have to explicitly call super(int n) , else the compiler would place an implicit super() and would still generate the error."
Wouldn't the Base class also have implict super() constructor which in turn calls the parent Object's constructor()? So no compilation occurs evcen though no Base() constructor in Base class?? Please correct me..
Congrats! and thanks for the info.
Question to everyone(about the books):
I've looked over at the Jave 2 certification guide by roberts heller. Are there any other books that you feel is a MUST-read for the SCJP2 exam??
please reply