본문 바로가기

JAVA

자바 기초 다지기 #4

이번 글은 문자열에 대한 공부를 재진행 해보았다.

public class StringApp { // StringApp 클래스 생성

 

public static void main(String[] args) {

System.out.println("Hello World"); // " "은 String을 나타낸다.

System.out.println('H'); //' ' Character를 나타낸다

System.out.println("H");//String(문자열) 출력

 

System.out.println("Hello "+ "World"); //Hello World를 합쳐서 출력

 

// new line

System.out.println("Hello \nWorld");// 줄 바꿈 하여 Hello Wrold 출력

 

// escape

System.out.println("Hello \"World\"");// Hello "World" 특수문자를 출력하기위해 사용

}

 

}

'JAVA' 카테고리의 다른 글

자바 기초다지기(#8)  (0) 2020.09.22
#자바 기초다지기(#7)  (0) 2020.09.22
자바 기초 다지기 (#5)  (0) 2020.09.21
자바 기초 다지기 #3  (0) 2020.09.11
자바 기초 다지기 #2  (0) 2020.09.11