Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java scanner string to int

Scanner scanner = new Scanner(System.in);
    while (true) {
        String input = scanner.next();
            try {
                int a = Integer.parseInt(input);
                if (a == 0) {
                    break;
                }
                System.out.println(Integer.parseInt(input) * 10);
            } catch (NumberFormatException e) {
                System.out.println("Invalid user input: " + input);
            }
        }
Comment

PREVIOUS NEXT
Code Example
Java :: java read directory 
Java :: java singleton implementation 
Java :: intent flag clear task 
Java :: java numbers 
Java :: instantiate optinal java 8 
Java :: A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution java.lang.reflect.InvocationTargetException (no error message) 
Java :: java stream distinct by object atribute 
Java :: java regex 10 digit number 
Java :: string reverse in java 
Java :: json to hashmap java stream 
Java :: arraylist items into string 
Java :: check palindrome in java 
Java :: permutation array java 
Java :: cannot find symbol variable log 
Java :: dark mode app android studio 
Java :: validate date java 
Java :: Java Converting int to double 
Java :: how to print something in java 
Java :: sort descending java stream 
Java :: numbers of digits java 
Java :: android ask if system is in dark mode 
Java :: how to convert int to string in java? 
Java :: remove duplicates from sorted array 
Java :: arraylist reverse in java 
Java :: get length of a string java 
Java :: pointers in java 
Java :: list of numbers java 
Java :: android iinput edit text password icon change 
Java :: android sha1 key 
Java :: radio button in java 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =