Àý´ë°ªÀ» ±¸ÇÏ´Â ¿¹Á¦
TestAbs.java
public class TestAbs {
public static void main(String args[]) {
int a = -4;
double b = -32.3;
System.out.println("The absolute value of a is " + Math.abs(a));
System.out.println("The absolute value of b is " + Math.abs(b));
}
}
C:\javaExample\Math>javac TestAbs.java
C:\javaExample\Math>java TestAbs
The absolute value of a is 4
The absolute value of b is 32.3
MathŬ·¡½ºÀÇ abs()¸¦ ÀÌ¿ëÇØ¼ Àý´ë°ªÀ» ±¸ÇÒ ¼ö ÀÖ´Ù.
jabookÀúÀÚ¸íÇÔ |
Á¦¸ñ:¼Ò¼³°°Àº¹Ì´ÏÄÚµå ÀÛ¼ºÀÚ:Àںϸâ¹ö ÇÑâÇå |