cowboy55

Greenhorn
since Jun 18, 2000
For More
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
0
0
Total given
0
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

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);
}
}
23 years ago
Thank you all for your kinda explanations.
I understand it now.
regards
23 years ago
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
23 years ago
Steve,
can u explain ur method in more detail?
23 years ago
What will be output from following?
System.out.println(010|4);
1) 14
2) 0
3) 6
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?
23 years ago
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;
can some one explain??

Also, is this statement true?
"An interface cannot be instantiated"
thank you
23 years ago
Congrats!!
Best wishes for your futre endeavors.
regards
23 years ago
Thank you ppathak and herbert for your explanation. It helps me better to see what possible cases might happen that would require thread synchronization.
"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

23 years ago
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.
regards
23 years ago
Congrats!
Best wishes for your future endeavors!!
regards
23 years ago
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.
23 years ago
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).]
23 years ago
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
23 years ago
Congrats! and thanks for the info.