About 19,300,000 results
Open links in new tab
  1. How to accept strings or integers in the same user input

    Apr 12, 2014 · you should read the input from your scanner as String type and the try to convert that String input into integer using Integer.parseInt(). If its successful in parsing, it means user …

  2. java - Input String and int in the same line - Stack Overflow

    How can I input a String and an int in the same line? Then I want to proceed it to get the largest number from int that I already input: Here is the code I have written so far. import java.util.S...

  3. user input string and integers in Java - Stack Overflow

    Oct 21, 2013 · System.out.print("Name : "); String name = in.nextLine(); System.out.print("Age : "); int age = in.nextInt(); //add in.nextLine(); System.out.print("City : "); String city = in.nextLine();

  4. Java Input and Output (I/O) - University of Wisconsin–Madison

    Sep 3, 2008 · You will need to parse (convert) the String object into an int value if you wish to store it in an int variable or data member. Here's one way to do this: Get a String of characters …

  5. How to Take Input From User Separated By Space in Java - GeeksforGeeks

    Feb 1, 2023 · Using readline () method of BufferedReader and Scan the whole string. Iterate over the above array and parse each integer value using Integer.parseInt ( ). Method 2: Using …

  6. Java User Input – Scanner Class - GeeksforGeeks

    Apr 22, 2025 · The most common way to take user input in Java is using the Scanner class. It is a part of java.util package. The scanner class can handle input from different places, like as we …

  7. Multiple String Input In Java Using Scanner [With Coding …

    Feb 19, 2024 · Though it is not an efficient way of reading inputs in a Java program where time acts as a constraint, it is undoubtedly one of the easiest ways to collect multiple inputs from …

  8. Java Program to get input from user - BeginnersBook

    Sep 10, 2022 · In this tutorial we are gonna see how to accept input from user. We are using Scanner class to get the input. In the below example we are getting input String, integer and a …

  9. How to Get User Input in Java

    Learn how to get user input in Java using Scanner class and other methods. Step-by-step guide with code examples to take input from the console efficiently.

  10. Java Scanner User Input Example - TheServerSide

    Aug 8, 2022 · This tutorial on how to use the Java Scanner for user input will quickly show you how to import java.util, take String, int, double and char input, and teach you the difference …

  11. Some results have been removed
Refresh