* 자바 및 이클립스 설치 후 터미널에서 version과 javc 출력해보고 이클립스 열어서 class형 파일을 만들어서 test 진행
package practice;
public class Main {
public static void main(String[] args) {
//1.println 칸띄우기
System.out.println("hello world");
//숫자, 스트링의 개념
// System.out.print(10+2000+"200");
// System.out.println(10+2000+"200");
//2. 변하지않는 변수값(상수) 설정 : final
int x = 30;
x = 40;
final int y = 30;
// y = 20; =>주석 해제하고 print할 경우 경고
System.out.println(x);
System.out.println(y);
//3.변수란? -기본형, 참조형
//정수
byte a ; // lbyte = 8bits -128~127
a=10;
short b; // 2byte = 16bits -32,768~32,767
b=100;
long l = 30L //긴 길이의 정수사용 가능
int c ; // 4bytes = 32bits -2,-.....
c=1000;
c=2000;
c = c+500;
long d; //16bytes = 64bits -9,-...
d=2000;
System.out.println("a:"+a +",b:"+b+ ",c:"+c);
//실수형
float e; //4bytes 소수 6자리 오차없이 표
e=3.14159f; //f안 붙이면 type mismatch
double f ; //8bytes 소수 15자리 오차없이 표
f = 3.141591415914159;
System.out.println("e:"+e+",f:"+f);
e = e+a;
System.out.println(e);
//문자형: char, String ***char => ''(작은따옴표사용가능) , String =>""(큰따옴표사용가능)
char g; // unicode 로 문자 표현, 2의 16승
String str = "this is string"
g = 'A';
System.out.println(g);
//논리형
boolean h; //1byte true,false
h = true;
System.out.println(h);
}
}