Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java string to int

//String to int , scanner, NumberFormatException, 
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);
            }
        }
Source by talentify.com #
 
PREVIOUS NEXT
Tagged: #java #string #int
ADD COMMENT
Topic
Name
1+1 =