Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

User input (scanner)

int age = scanner.nextInt();
scanner.nextLine(); //Ez fogja az ottmaradt sorvége jelet beolvasni
        
String name = scanner.nextLine();
Comment

User input (scanner)

String line = scanner.nextLine();
int age = Integer.parseInt(line); // Exception-t 
Comment

User input (scanner)

Scanner scanner = new Scanner(System.in);

System.out.println("What's your name?");
String name = scanner.nextLine();

System.out.println("What's your year of birth?");
int yearOfBirth = scanner.nextInt();
Comment

PREVIOUS NEXT
Code Example
Java :: java arraylist initialize with 0 
Java :: exception class implementation in java 
Java :: the import junit cannot be resolved maven 
Java :: Java Remove ArrayList Elements 
Java :: observer design pattern 
Java :: getter in java 
Java :: remove duplicates from list java 
Java :: limit decimals java 
Java :: array index out of bound exception in java 
Java :: capture console output java 
Java :: spring boot send api request 
Java :: java how to create subclass 
Java :: unresolved reference activity_main 
Java :: switch in java 
Java :: convert string array to string 
Java :: array in java 
Java :: java add values to array 
Java :: javax 
Java :: java returns null 
Java :: check if object is empty java 8 
Java :: calling a void method java 
Java :: Print the string after the specified character java 
Java :: if else bedingungen java 
Java :: execute a multi line shell comand in java 
Java :: intergers are appearing as string in Json 
Java :: key caracter from code java 
Java :: Remove ArrayList Elements using remove() function 
Java :: destroy fragent after navigating 
Java :: filterreader converts a string to uppercase java 
Java :: using addition to multiply in java 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =