Skip to content

Instantly share code, notes, and snippets.

@Loule95450
Last active September 28, 2021 16:36
Show Gist options
  • Save Loule95450/b5e7b9d99dfdc8dde64de0ed27e5e215 to your computer and use it in GitHub Desktop.
Save Loule95450/b5e7b9d99dfdc8dde64de0ed27e5e215 to your computer and use it in GitHub Desktop.
Prompt in Java with Scanner
package me.loule; //Change this
// import Scanner
import java.util.Scanner;
public class Scanner {
public static void main(String[] args) {
// Clear Console
System.out.print("\033[H\033[2J");
// Initialize Scanner
Scanner scanner = new Scanner(System.in);
// Prompt player names
System.out.print("👨‍💻 Enter your name: ");
String name = scanner.nextLine();
System.out.println("Welcome " + name);
}
}
@Loule95450
Copy link
Author

Loule95450 commented Sep 28, 2021

⚠️ - What needs to be changed !

Remove package me.loule; replace this with your company name (Default: package com.company; with IntelliJ)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment