P Ventura

Ranch Hand
+ Follow
since Jan 24, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by P Ventura

Javabeans prefix for methods are only get/set for getter and setters.
If a property is a boolean a getter can be is:
Example
Source: vodoo exam


int i = 10 ; // line 1
i = ++i ; // line 2
i = i++ ; // line 3
System . out . println ( i ); // line 4



Why output is 11 and not 12?
Hi ranchers,
in what situation, adding to a Collection generates a warning, but compile fine?
I don't remember it and I can't found where I readed it?

Please help me I'm trying to fix errors ragarding generics concepts.
Source JQPLUS.

If a Thread's priority is not specified explicitly then it gets a priority of Thread.NORM_PRIORITY.

I answered true, but jqplus response was false because:

"Similar question has been asked in SCJP2.
In such a case, the Thread gets the same priority as the thread that has created it.
So if a thread t1 having a priority Thread.MAX_PRIORITY creates a thread t2, t2 will also get a priority of Thread.MAX_PRIORITY......"

I remember something about on K&B saying that a new thread always has NORM_PRIORITY.

I also tried this code that print 10(Maxpriority (I know that depends on JVM)) 5 (norm_priority )".


What is the correct answer?
<T extends A> can be used when you define a class that use generics. Adding an elements depends of source code.
Infact in this example you can add elements:

Source: vodoo exam

double a=10/0.0
double b=11/0.0

a==b is true!
Why?
I thought so: 10 is an int and 0.0 is a double => 10/0.0 is a double =>
a and b = NaN => a== b is false because NaN != NaN. Where is the mistake?

Originally posted by Robert Elbourn:
so why isn't c3 elligable for garbage collection ?

c3= c1.go(c2);

c1.go(c2) returns null

so isn't that the same as
c3 = null ?



I think c3 is eligible too. I wait a response from experts.
I agree Kelvin.... ther're very non-intuitive and confusing. Let's hope that aren't in the exam!
hashcode is used in collections. It's used to find a bucket where your object will be inserted. If you don't understand this, read something about Collections and Maps and all will be clear.
Source: http://www.geocities.com/skmajji/Main.html

why the following code prints "True"? It's a comparison between
two constants!?
Hi ranchers,
I want only notify that this does't compile



instead

compile well.

K&B says only that boundaries are permitted and show an example
with extends.

Pay attention!
Person is not comparable: if you change to this, all works

Originally posted by Jan Nowak:
I am confused about this code:



Here I thought that there will be exception as well because of cast added by the compiler but it is ok. Can anyone please explain me this?



Hey that code doesn't compile: you can't add an Integer to a String List.
I agree with you, setMax... must limit fraction digits to 5.

I can't help you for my locale
When I run it, print

123,45679
1234567555
1234567