Run --> Run Configurations --> Arguments (it is the 2nd tab on the right) --> Program arguments

Answer from WuHoUnited on Stack Overflow
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › string input in java
How to Take String Input in Java - Methods Explained | upGrad
June 22, 2025 - By mastering this fundamental skill, you'll be well-equipped to create dynamic and interactive Java programs that effectively handle textual data and user interactions. To take string input in Java, we can use the java.util.Scanner class that provides methods to read input from various sources, including the standard input (keyboard) and files.
Discussions

eclipse - Input values to a normal JAVA SE program - Stack Overflow
If I remember correctly, you can actually type in Eclipse's Java console and that will be sent through the standard input stream, System.in (probably depending on the application's run configuration). However the standard way of doing this is to pass a number of strings on the command line, ... More on stackoverflow.com
🌐 stackoverflow.com
December 1, 2009
How to get the user input in Java? - Stack Overflow
I attempted to create a calculator, but I can not get it to work because I don't know how to get user input. How can I get the user input in Java? More on stackoverflow.com
🌐 stackoverflow.com
eclipse - Java input methods? - Stack Overflow
I'm currently attempting to write a role-playing game with Eclipse (don't know how far I'll get, but who knows) and I'd like to prompt the user to answer with a sentence/phrase. I'm learning very... More on stackoverflow.com
🌐 stackoverflow.com
how to pass inputs to java using eclipse? - Stack Overflow
I am trying to get the user input using the following code but on running it gives the error that Arrayindexoutofbounds. Don't know what is the problem. public static void main(String[] args) { ... More on stackoverflow.com
🌐 stackoverflow.com
People also ask

Can I use a file instead of the console to input strings?
Yes, by constructing a Scanner object with a File object corresponding to the file we wish to read, we may use the Scanner class to read string input from a file. We would supply the File object to the Scanner constructor instead of System.in. Using this technique, we can read strings from a file and process them accordingly.
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › string input in java
How to Take String Input in Java - Methods Explained | upGrad
Is it possible for me to accept several strings on a single line?
Yes, the next() method of the Scanner class can take several strings as input on a single line. This method reads the subsequent token from the input, a string of characters mostly separated by spaces. To read several strings entered on the same line, call the next() method multiple times.
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › string input in java
How to Take String Input in Java - Methods Explained | upGrad
🌐
Java Made Easy!
java-made-easy.com › java-scanner.html
Java Input Using Java Scanner
First of all you will need to use a Java Scanner that will get this input for you. It acts like a variable but it's not one of the basic types that were talked about in the previous tutorial. Add this line into the main: It is EXTREMELY important that you get the capitalization correct, or this will not work. You will also notice that Eclipse has underlined Scanner in red, as shown in the next screenshot.
🌐
Javatpoint
javatpoint.com › how-to-take-string-input-in-java
Take String input in Java - javatpoint
How to take String input in Java with oops, string, exceptions, multithreading, collections, jdbc, rmi, fundamentals, programs, swing, javafx, io streams, networking, sockets, classes, objects etc,
Find elsewhere
🌐
BeginnersBook
beginnersbook.com › 2024 › 06 › how-to-take-string-input-in-java
How to take String Input in Java
June 9, 2024 - import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class StringInputExample { public static void main(String[] args) { // Create a BufferedReader object BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); // Prompt user for string input System.out.println("Enter a string:"); try { // Read user input String input = reader.readLine(); // print user entered string System.out.println("You entered: " + input); } catch (IOException e) { e.printStackTrace(); } } }
🌐
Scaler
scaler.com › home › topics › string input in java
String Input in Java - Scaler Topics
May 4, 2023 - With the help of the I/O package, ... characters, and so on. For taking string input we can make use of various methods like using Scanner class, BufferedReader class, and Command Line argument....
🌐
DataFlair
data-flair.training › blogs › how-to-take-string-input-in-java
How to Take String Input in Java? - DataFlair
May 30, 2026 - The String input is: . FullStop!!! The Scanner class, also known as the utility scanner, is the more widely used class for taking user input. It is part of the java.util package.
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Java-String-input-with-the-Scanner-class
Java Scanner String input example
Notice how the output includes only the first String the Java Scanner read. The rest of the text is ignored. This is because the Scanner class tokenizes the input String based on any whitespace between words.
Published: April 20, 2026
🌐
JavaBeat
javabeat.net › input-string-java
How to Input a String in Java?
January 31, 2024 - The BufferedReader class is more efficient and effective for taking larger streams of character-based string input. It uses the buffering mechanism which makes it more flexible than the Scanner class for working with the strings. The BufferedReader, IOException, and InputStreamReader classes are provided by the java.io package which is imported as below:
🌐
YouTube
youtube.com › watch
Eclipse - Taking inputs Scanner class - YouTube
This video goes through how to take inputs in Java using the Scanner class
Published: September 15, 2012
🌐
Tpoint Tech
tpointtech.com › how-to-take-string-input-in-java
Take String input in Java - Tpoint Tech
May 1, 2026 - The nextLine() method of Scanner class is used to take a string from the user. It is defined in java.util.Scanner class. The nextLine() method reads the text until the end of the line. After reading the line, it throws the cursor to the next line · The signature of the method is:
🌐
UW Computer Sciences
pages.cs.wisc.edu › ~hasti › cs368 › JavaTutorial › NOTES › JavaIO_Scanner.html
Java Input and Output (I/O)
September 3, 2008 - The console window is the window that is automatically launched when you run a program from within Eclipse. Console input is any input that is entered in the console window instead of typing it into a field or dialog box that pops up in a window. For example, when the nextLine method is called, the program waits for the user to enter information. Whatever the user types is returned to the program in the form of a String object.
🌐
DEV Community
dev.to › realedwintorres › tutorial-accepting-string-input-in-java-4j9o
Tutorial: Accepting String Input in Java - DEV Community
October 31, 2021 - Some Java programs need input from the user. To accept input from the user, use the Scanner class. The Scanner class has methods that accept different types of input. This tutorial describes string input.
🌐
Stack Overflow
stackoverflow.com › questions › 17155983 › input-from-the-user-using-java
eclipse - input from the user using java - Stack Overflow
Scanner in = new Scanner(System.in); System.out.println("Enter a string"); String s = in.nextLine(); System.out.println("You entered string " + s); [2] and this prints null · BufferedReader columnInput = new BufferedReader(new InputStreamReader( System.in)); try { System.out.println(columnInput.readLine()); // System.out.println("#read mflkerf: " ); } catch (IOException e) { } java · eclipse ·