float and double Primitive Types
2021. 2. 17. 21:33ㆍJava programming
byte, short, long, width의 차이점과 각각 maximum values와 minimum values에 대해 배웠다!
so far so good!
package academy.learnprogramming;
public class Main {
public static void main(String[] args) {
int myValue = 10000;
int myMinIntValue = Integer.MIN_VALUE;
int myMaxIntValue = Integer.MAX_VALUE;
System.out.println(myValue);
System.out.println("Integer Minimum Value = " + myMinIntValue);
System.out.println("Integer Maximum Value = " + myMaxIntValue);
System.out.println("Busted Max Value = " +(myMaxIntValue + 1));
System.out.println("Busted Min Value = " +(myMinIntValue - 1));
int myMaxIntTest = 2_147_483_647;
byte myMinByteValue = Byte.MIN_VALUE;
byte myMaxByteValue = Byte.MAX_VALUE;
System.out.println("Byte Minimum Value = " + myMinByteValue);
System.out.println(("Byte Maximum Value = " + myMaxByteValue));
short myMinShortValue = Short.MIN_VALUE;
short myMaxShortValue = Short.MAX_VALUE;
System.out.println("Short Minimum Value = " + myMinShortValue);
System.out.println(("Short Maximum Value = " + myMaxShortValue));
long myMinLongValue = Long.MIN_VALUE;
long myMaxLongValue = Long.MAX_VALUE;
System.out.println("Long Minimum Value = " + myMinLongValue);
System.out.println(("Long Maximum Value = " + myMaxLongValue));
long bigLongLiteralValue = 2_147_483_647_234L;
System.out.println(bigLongLiteralValue);
int myTotal = (myMinIntValue / 2);
byte myNewByteValue = (byte) (myMinByteValue / 2);
short myNewShortValue = (short) (myMinShortValue / 2);
}
}
package academy.learnprogramming;
public class Main {
public static void main(String[] args) {
byte createNewByte = (byte) 123533;
short createNewShort = (short) 33248218;
int createNewInt = 32415523;
long createNewLong = 50000 + 10 * (createNewByte + createNewShort + createNewInt);
System.out.println(createNewLong);
int myIntValue = 5;
float myFloatValue = 5.25f;
double myDoubleValue = 5.25d;
double numberOfPounds = 1;
double convertedKilograms = numberOfPounds * 0.45359237;
System.out.println("10 Kilograms = " + convertedKilograms * 10);
char myChar = 'D';
char myUnicodeChar = '\u0044';
System.out.println(myChar);
System.out.println(myUnicodeChar);
boolean myTrueBooleanValue = true;
boolean myFalseBooleanValue = false;
boolean myCustomerOverTwentyOne = true;
}
}
'Java programming' 카테고리의 다른 글
Coding Exercise 3: Barking Dog (0) | 2021.02.18 |
---|---|
Coding Exercise 2: MegaBytes Converter (0) | 2021.02.18 |
Coding Exercise 1: Speed Converter (0) | 2021.02.18 |
Operators, Operands and Expressions (0) | 2021.02.17 |
Hello World! - 미약한 시작 (0) | 2021.02.17 |