자바 1일차

정준호·2022년 1월 17일
0

자바

목록 보기
1/27

자바란?
프로그래밍 언어(programming Language)
1.출력
public class Ex01 {

public static void main(String[] args) {
  
	//주석은 컴퓨터가 실행 시키지 않는 설명문!
	
	//컴퓨터에 문자열 띄우기
	System.out.println("반가워요 여러분!!");
}

}

2.변수선언출력
public class Ex02 {

//컴파일 : 클래스 파일을 실행 시키는 작업의 말
public static void main(String[] args) {
	
	//1. 변수 선언하기
	int a = 0;
	
	System.out.println(a);
	
	a = 5;
	
	System.out.println(a);
	
	//calss 실행시키는 단축키 : ctrl + F11
}

}

3.실수형변수 선언
public class Ex03 {

public static void main(String[] args) {

	//빠르게 한줄 삭제하기 : ctrl + D
	
	//정수형 변수 선언하기
	//정수형 : byte, short, int(4byte), long
	
	int a = 2;
	
	//실수형 : float, double(8byte)
	
	double b = 3.15;
	float c = 1.2f;
	
	System.out.println(b);
	System.out.println(c);
}

}

profile
파이팅

0개의 댓글