Java Tutorial Lesson 02: static methods

From Erlands Wiki

Jump to: navigation, search

Start with a java class “Game” that looks as follows:

public class Game {
    private static void print() {
        System.out.println("----------");
        System.out.println("|        |");
        System.out.println("|        |");
        System.out.println("|        |");
        System.out.println("----------");
    }
}

Your job is to implement the main method so the class can be called with:

java Game

And generate the output:

Lesson 2
 
----------
|        |
|        |
|        |
----------
Personal tools