avatar
John Selawsky
0

Codes

2

Answers

Code compilers

Top answers

0
Java Code (.java)
April-26-2023
public class MathExample {
   //java.lang.Math.round() method example with float and double arguments
   public static void main(String[] args) {
       double e = 2.71828;
       float pi = 3.1415f;
       //Math.round() method: float turns to int
       int intOfPi = Math.round(pi);
       //Math.round() method: double  turns to long
       long intOfE = Math.round(e);
       System.out.println("integer part of pi = " + intOfPi);
       System.out.println("integer part of e = " + intOfE);

   }

}
0
Java Code (.java)
April-26-2023
public class NewYear{

//using main function
	static void main(String... newyearargs){ // defining main() method here

		System.out.println("Happy New Year");

	}
}