Skip to content

Instantly share code, notes, and snippets.

@extsalt
Created June 19, 2021 04:18
Show Gist options
  • Save extsalt/0d072c2aa4204b4ae15f3ba06429b371 to your computer and use it in GitHub Desktop.
Save extsalt/0d072c2aa4204b4ae15f3ba06429b371 to your computer and use it in GitHub Desktop.
How to get input in Java?
import jdk.jshell.spi.SPIResolutionException;
import java.sql.*;
import java.util.Scanner;
public class Main {
public static void main(String... args) throws ClassNotFoundException, SQLException {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter data : ");
String data = scanner.next();
System.out.println(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment