본문 바로가기
수업

10월 1일 - 자바 기초 개념

by hojin880214 2018. 10. 1.

파일이름 = 클래스이름


컴파일러 compiler = javac


java = 인터프리터 (interpreter)


.java ->컴파일 -> .class (=바이트코드)


자바API = 빌트인클래스, 리소스, 라이브러리, 클래스묶음, 자원 -> rt.jar       java 하위폴더 lang폴더에위치



인터프리터 + API = 자바 플랫폼


인터프리터 + API + 바이트코드



키워드 = 예약어 (static, class, void등등)


식별자(identifiers)

대표적으로 클래스이름, 함수이름, 변수이름


클래스이름 HelloJava  HelloProgramming 대문자유의 



class는 변수와 함수로 구성


변수 = 필드 =소속변수


함수 = 메소드


자바최소단위 클래스

클래스최소단위 메소드



main()이 메소드 이름이고 괄호 내부의 String[] args를 메소드 인자 (method arguments)라고 한다


메소드 main()이 속한 클래스만이 인터프리터에 의해 실행될 수 있다



콘솔어플리케이션의 시작은 main()함수이다





클래스{} 쓰고 파일저장








































public class HelloProgramming{


public static void main(String[] args){


System.out.prinln("HelloProgramming");


} // end of main()


} // end of HelloProgramming















public class HelloProgramming{

//변수를 선언

static String str= "안녕하세요";

static String str1= "안녕하세요11112";

static String str2= "안녕하세요22222";


public static void write(String word){

System.out.println(word);

} // end of write()

public static void write2(String word2){

System.out.println(word2);

} // end of write2()


public static void main(String[] args){


System.out.println("HelloProgramming");

System.out.println(str);

write(str1);

write2(str2);

} // end of main()


} // end of HelloProgramming



























댓글