Hai, I am planning to appear for Sun Certification and I have joined new in this forum. Let me have those advantages of clear concepts. Thanks. 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.
Hi, 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? Explanation:- 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