Java의 스캐너 클래스 nextInt(), nextLong(), nextDouble() 등을 지원합니다. 하지만 nextChar()는 없습니다. 이것 예를 들어) 문자를 읽으려면 다음을 사용합니다. 다음().charAt(0) . next() 함수는 입력의 다음 토큰/단어를 문자열로 반환하고 charAt(0) 함수는 해당 문자열의 첫 번째 문자, CharAt( 함수의 숫자 0을 반환합니다. 숫자 )는 입력된 문자열의 단일 단어 인덱스를 나타내고 해당 인덱스 문자를 char 변수에 설정합니다.
YouTube 비디오 vlc 다운로드
자바
자바 사용자 입력
// Java program to read character using Scanner> // class> import> java.util.Scanner;> public> class> ScannerDemo1 {> >public> static> void> main(String [] args){> >Scanner sc =>new> Scanner(System.in);> >char> c = sc.next().charAt(>1>);> >// here this is the indexing of the element to take //> >System.out.println(>'c = '>+c);> >}> > }> > > > |
>
>
HTML의 자바스크립트 호출 함수
입력 :
ge>
출력 :
c = e>