The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes SCJP doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "SCJP doubt" Watch "SCJP doubt" New topic

SCJP doubt

Padmalatha Ravi

Joined: Aug 16, 2000
Posts: 2
I am planning to appear for Sun Certification and I have joined new in this forum. Let me have those advantages of clear concepts.
Question 1.
Which of the following statements are valid for a method which overrides the foll:
protected void method(int x) {..}
a. overiding method takes int as only parameter.
b. Overriding method must return a void.
c.overriding method can be declared as private.
d.overiding method can return any value it wishes.
Kindly clear my doubt as I have chosen a,b. Is that true?
Quetion 2:
Is -0.0 different from 0.0?
In that case what would be the right answer for ceil() and floor() of -0.5? Kindly clear my doubt.
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Your answer for Q1) is correct.
For Q2), yes in Java -0.0 is different from +0.0 and ceil(-0.5) will give -0.0 as result.
maha anna
Marcela Blei
Ranch Hand

Joined: Jun 28, 2000
Posts: 477
Maha: In ABHILASH test there is a question about:
Where -0.0 is the result, what�s true about this?
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
Even 0.0 is a signed number. -0.0 is less than 0.0 .
However, -0.0 == 0.0 returns true.
I know it is weird, but that's the way it is

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).

Joined: Aug 14, 2000
Posts: 9
Quetion 2:
Is -0.0 different from 0.0?
In that case what would be the right answer for ceil() and floor() of -0.5?
JLS says:
Positive zero and negative zero compare equal;
0.0==-0.0 is true
0.0>-0.0 is false.
But other operations can distinguish positive and negative zero;
1.0/0.0 is positive infinity,
1.0/-0.0 is negative infinity.
So Math.ceil(-0.5) gives -0.0
Math.floor(-0.5) gives -1.0
Hope this may help

iop lkj

Joined: Dec 08, 2004
Posts: 1
Can any one give a link to the ABHILAASH test ?
Harry Chawla
Ranch Hand

Joined: Jun 03, 2000
Posts: 97
here it is http://www.angelfire.com/or/abhilash/Main.html
I agree. Here's the link: http://aspose.com/file-tools
subject: SCJP doubt