repl.it
@SagaciousPan/

Get string from scanner

Java

No description

fork
loading
Files
  • Main.java
  • jdt.ls-java-project
Main.java
1
2
3
4
5
6
7
8
9
10
11
import java.util.Scanner;
class Main {
  public static void main(String[] args) {
        System.out.print("Enter a string : ");
        Scanner scanner = new Scanner(System. in);
        String inputString = scanner. nextLine();
        System.out.println("String read from console is : \n"+inputString);
  }
}