package day02;
public class Ex01 {
public static void main (String [] args) {
long regNo = 9111111111111L; //2-2
System.out.println("1" +"2"); //2-5
System.out.println(true + "");
System.out.println('A'+ 'B');
System.out.println('1' + 2);
System.out.println('1'+ '2');
System.out.println('J'+"ava");
char ch = 'A'; //2-9
short s = (short)ch;
System.out.println(s);
int x = 2; //3-1
int y = 5;
char ca = 'A';
System.out.println(1 + x <<33);
System.out.println(y >=5 || x<0 && x>2);
System.out.println(y += 10 - x ++);
System.out.println(x+=2);
System.out.println(!('A' <= ca && ca <= 'Z'));
System.out.println('C' - ca);
System.out.println('5'-'0');
System.out.println(ca+1);
System.out.println(++ca);
System.out.println(ca++);
System.out.println(ca);
int numOfApples = 123; //3-3
int sizeOfBucket = 10;
int numOfBucket = numOfApples % sizeOfBucket > 0 ? numOfApples/10 + 1 : numOfApples % sizeOfBucket == 0 ? numOfApples/10 : numOfApples;
System.out.println("필요한 바구니의 수 :" + numOfBucket);
int numOfBucket2 = numOfApples % sizeOfBucket != 0 ? numOfApples/10 + 1 : numOfApples/10;
System.out.println("필요한 바구니의 수 :" + numOfBucket2);
int num = 10; //3-4
System.out.println( num > 0 ? "양수" : (num == 0 ? "0": "음수"));
int sNum = 333; //3-5
System.out.println(sNum / 10 * 10 +1);
int aNum = 24; //3-6
System.out.println((aNum /10 +1) *10 -aNum);
int farhrenheit = 100; //3-7
float celcius = (float)5/9*(farhrenheit-32) *1000 % 10 >= 5 ? (float) ((int) (5/9f*(farhrenheit-32)*100 +1) )/100 : (float) ((int) (5/9f*(farhrenheit-32)*100) )/100;
System.out.println("Fahrenheit :" +farhrenheit);
System.out.println("Celcius :" +celcius);
byte a = 10; //3-8
byte b = 20;
byte c = (byte)(a + b);
char charr = 'A';
charr = (char) (charr +2);
float f = 3/2f;
long l = 3000 * 3000* 3000L;
float f2 = 0.1f;
double d = (float)(0.1);
boolean result = d==f2;
System.out.println("c="+c);
System.out.println("charr=" + charr);
System.out.println("f="+f);
System.out.println("l="+l);
System.out.println("result ="+result);
char chas = 'z'; //3-9
boolean b1 = (48 <= chas && chas <=129);
System.out.println(b1);
char ch123 = 'A'; //3-10
char lowerCase = 65 <= ch123 && ch123 <= 96 ? (char)(ch123 + 32) : ch123;
System.out.println("ch :" + ch123);
System.out.println("ch to lowerCase :" +lowerCase);
}
}
IT/Java
댓글