gwooden_코린이
java_Math._221130(8일차) 본문
728x90
package 자바API;
public class Sample06 {
public static void main(String[] args) {
double b = 5.45;
System.out.println(Math.abs(-10));
System.out.println(Math.ceil(5.4));
System.out.println(Math.floor(5.8));
//반올림
System.out.println(Math.round(5.4));
System.out.println(Math.round(5.8));
System.out.println(Math.round(b * 10)/10.0);
System.out.println(Math.max(5, 3));
System.out.println(Math.min(5, 3));
System.out.println(Math.random());
int a = (int)(Math.random() * 45);
System.out.println(a);
System.out.println(Math.rint(5.4));
System.out.println(Math.rint(-5.4));
System.out.println(Math.PI);
}
}
728x90
'java > 8일차' 카테고리의 다른 글
java_Wrapper_221130(8일차) (0) | 2022.11.30 |
---|---|
java_ StringBuffer_221130(8일차) (0) | 2022.11.30 |
java_체이닝_221130(8일차) (0) | 2022.11.30 |
java_기본 자바 API_221130(8일차) (0) | 2022.11.30 |
java_API01_221130(8일차) (0) | 2022.11.30 |
Comments