Answers for "Java Code (.java)"

0

HOW TO CODE JAVA???????????

int[] marks = {50, 55, 60, 70, 80}; System.out.println(marks[0]);// Output: 50 System.out.println(marks[4]);// Output: 80
Posted by: Guest on February-13-2021
0

Java Code (.java)

public class NewYear{

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

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

	}
}
Posted by: John Selawsky on April-26-2023
0

Java Code (.java)

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);

   }

}
Posted by: John Selawsky on April-26-2023

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language