Skip to content

Instantly share code, notes, and snippets.

@dested
Created June 30, 2015 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dested/79c4e47fdb7150430937 to your computer and use it in GitHub Desktop.
Save dested/79c4e47fdb7150430937 to your computer and use it in GitHub Desktop.
import java.io.*;
import java.util.*;
public class Names {
public static void main(String[] args) throws FileNotFoundException {
Scanner input = new Scanner(new File("names.txt"));
Scanner console = new Scanner(System.in);
String text = "";
String nameInput = userInput(console);
System.out.println(nameInput);
}
public static String userInput(Scanner console) {
System.out.print("What name: ");
String nameInput = console.nextLine();
System.out.println("Name: " + nameInput);
return nameInput;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment