cowboy55

Greenhorn
+ Follow
since Jun 18, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by cowboy55

Hi,
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{
Base(){
int i = 100;
System.out.println(i);
}
}
public class Pri extends Base{
static int i = 200;
public static void main(String argv[]){
Pri p = new Pri();
System.out.println(i);
}
}
Thank you all for your kinda explanations.
I understand it now.
regards
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
Ex.
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??
thanks
Steve,
can u explain ur method in more detail?
What will be output from following?
System.out.println(010|4);
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?
Given,
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;
3)j=i<<d;>
4)j=i<<1;
Answeris 2 and 4
can some one explain??

Also, is this statement true?
"An interface cannot be instantiated"
thank you
Congrats!!
Best wishes for your futre endeavors.
Please stick around and share your experty.
regards
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?
thanks

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
regards
Congrats!
Best wishes for your future endeavors!!
regards
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.
Hi,
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..
regard
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
regards