Answer to Question #192927 in Java | JSP | JSF for Ajanya

Question #192927

What is the output of the following code?


import java.lang. Math. *;


class Main


public static void main(String args[])


System.out.println(Math.round(-7.5));


System.out.println(Math.abs(-7.5));


System.out.println(Math.ceil(-7.5)); System.out.println(Math.floor(-7.5));


}


}


1
Expert's answer
2021-05-13T04:54:43-0400
Correct code:

import java.lang. Math. *;

class Main{

public static void main(String args[]){
System.out.println(Math.round(-7.5));
System.out.println(Math.abs(-7.5));
System.out.println(Math.ceil(-7.5)); System.out.println(Math.floor(-7.5));
}
}



Output:

-7
7.5
-7.0
-8.0




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS