7 votes 7 votes Find the output of the following Java code line System.out.printIn(math.floor(-7.4)) -7 -8 -7.4 -7.0 Java isro2011 non-gate java + – go_editor asked Jun 23, 2016 go_editor 3.8k views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply moni2305 commented Jun 28, 2016 reply Follow Share For floor function We can write -7.4 as -7.0 only know Can u pls say how it will be -8 1 votes 1 votes Raki commented Jul 1, 2016 reply Follow Share Floor is a function in java which returns the lower limit. Here -8 is lower limit to -7.4 and the higher limit would be -7. If you represent these numbers on the number line you would have -7 approaching towards zero and -8 away from 7.4 and far from zero so the lower limit would be -8. Hence the answer is -8. 3 votes 3 votes ajayraho commented Mar 13 reply Follow Share Friends (like me :( ) who thought $-7$ would be the answer made a simple mistake. Floor function returns the smaller value. The negative the number the smaller the value. Thus floor(-7.4) will be $-8$ and not $-7$ 0 votes 0 votes Please log in or register to add a comment.
Best answer 11 votes 11 votes Ans B) -8 floor is lower limit srestha answered Jun 23, 2016 selected Jun 23, 2016 by Arjun srestha comment Share Follow See all 0 reply Please log in or register to add a comment.
2 votes 2 votes floor method of Java Math class. floor method returns the largest interger .so answer is (b) kvkumar answered Jun 26, 2016 kvkumar comment Share Follow See all 0 reply Please log in or register to add a comment.