round() Method in java

Java Programming Language Number Class in java (Article) Number Class in java (Program)

27470

Program:

public class WrapperroundMethod {


      public static void main(String args[]) {
	       double d = 100.675;
	       double e = 100.500;
	       float f = 100;
	       float g = 90f;

	       System.out.println(Math.round(d));
	       System.out.println(Math.round(e));
	       System.out.println(Math.round(f));
	       System.out.println(Math.round(g));
	    }
}

/*

Returns the closest long or int, as indicated
 by the method's return type to the argument.
 
*/

  

Output:

101
101
100
90
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.