Tags » Console

Using Scanner to take input from Console in Java

This small program to show how to take input from console (can be single or multiple lines)

public static void main(String[] args) throws Exception {
    Scanner console = new Scanner(System.in);
    Scanner lineTokenizer;

    int lineCount = 0;

    // this is to handle all 'lines'
    while (console.hasNextLine()) {
        String lineContent = console.nextLine();
        System.out.println(String.format("Line %d is %s", ++lineCount, lineContent));

        if (lineContent == null || lineContent.isEmpty()) {
            // this is to exit the program if there is no input anymore
        lineTokenizer = new Scanner(lineContent);

        int itemCount = 0;

        // this is to handle a 'line'
        while (lineTokenizer.hasNext()) {
            if (lineTokenizer.hasNext()) {
                long number = lineTokenizer.nextLong(); // consume the valid token

                System.out.println(String.format("Line %d - Number #%d is %d", lineCount, ++itemCount, number));
        lineTokenizer.close(); // discard this line

    console.close(); // discard lines.
32 more words

The Nintendo Console From The 80s Made For Recording Gameplay Footage

(Source: kotaku.com)

These days, if you want to record direct video footage of a video game, all you need to do is press a button. 410 more words


Earthlock added to Xbox Live Gold

Earthlock: Festival of Magic, an RPG is now included with Gold, along with Assassin’s Creed Chronicles: China. For whatever reason, Earthlock had top billing on my Facebook feed over… 11 more words

Video Games

The Witness to be ported on Xbox One

Indie developer’s Thekla’s auteur Jonathan Blow confirms this.

He told IGN it will be release September 13th.

Video Games

Hold Off 4 Now

If you you’re looking to take your first step into the next (current) generation of console gaming and are leaning towards Sony’s offering, it could be in your best interest to wait just a little longer. 195 more words


No Man's Sky Review (PC)

So far, as of writing this article, I have clocked in around 30+ hours since the PC release of No Man’s Sky. Boy, is there a lot to say about this title. 1,200 more words