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

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다