Language/JAVA

[JAVA 기초 이론] 스캐너 Scanner

오류나면꽥꽥 2023. 5. 11. 18:45

Scanner sc=new Scanner(System.in);

-> ctrl + shift + o : 자동임포트

-> 입력 값에 따라 자료형을 변경

자료형 변수명=sc.next();

 

ex)

int num=sc.nextInt();

this.name=sc.next();

String user=sc.next();