[자바]System.out.print/ln/f

매일 기록 습관·2024년 5월 20일

코테

목록 보기
2/5
public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		System.out.println("a = "+a +"\n" +"b = "+b);
        sc.close;
	}
}
  • \n 줄바꿈
    System.out.print
  • 기본 출력문
    System.out.println
  • 줄바꿈 출력문
    System.out.printf
  • 서식 출력문
  • %d 10진수 정수 출력 / %f 실수 출력 / %s 문자열 출력/ %c 문자 출력

0개의 댓글