Codes
Answers
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);
}
}
public class NewYear{
//using main function
static void main(String... newyearargs){ // defining main() method here
System.out.println("Happy New Year");
}
}
Questions
Answers
Answer accepted
Users
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us