Last active
September 28, 2021 16:36
-
-
Save Loule95450/b5e7b9d99dfdc8dde64de0ed27e5e215 to your computer and use it in GitHub Desktop.
Prompt in Java with Scanner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remove
package me.loule;
replace this with your company name (Default:package com.company;
with IntelliJ)