본문 바로가기

IT/java

printf, println, print 차이

System.out.printf("%-4s %c %3d \n", "둘리" , 'A', 12);

//String type : 왼쪽 4자리수 정렬

//char type : 출력

//int type : 3자리수 정렬

//서식 형태의 자료 출력


System.out.println("둘리 A 12");

//직관적 출력뒤 줄바꿈


System.out.print("둘리 A 12\n");

//직관적 출력 줄바꿈 \n 입력


<출력>

둘리   A  12

둘리 A 12

둘리 A 12



'IT > java' 카테고리의 다른 글

Eclips Window Builder 설치  (0) 2017.06.12
주민번호 검증  (0) 2017.05.24
switch 예제  (0) 2017.05.22
eclipse 설치 (Java EE)  (0) 2017.05.15
JAVA JDK 설치하기  (0) 2017.05.15