GameIOExample

import java.util.Scanner; public class GameIOExample { public static void main(String[] args) { System.out.println("Please press the Enter key to start."); Scanner readInput = new Scanner(System.in); String keyPress = readInput.nextLine(); if(keyPress.equals("")) { System.out.println("Enter was pressed"); } } }
In this snippet, we take a first look at how to get input and output in Java. This is our first step to creating an interactive game.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.