전공 과목 이수2👨‍💻/JAVA(공)

Java | 문자, 문자열, 따옴표출력하고싶을때, 줄바꿈기능

천숭이 2021. 3. 29. 19:55

문자 출력 '김' '회' '승'

문자열 출력 "김회승"

 

문자열끼리 +기능도 있음

System.out.println("자"+"바"); // 출력 : 자바

 

package soobin;

public class Test1 {
	public static void main(String[] args) {
		// 따옴표(")를 출력문에 포함하고싶을때는 역슬래시(\)를 앞에 써준다
		// ex) System.out.println("egoing said\"welcome programming world\"");
		System.out.println("egoing said\"welcome programming world\"");
		
		// 여러줄을 출력하고 싶은 경우 줄바꿈기호(\n)을 이용
		System.out.println("egoing said\nsoobin\nman");
	}
}

 

출력 :