0

Here's my code:

public class Wallgame {
    public static void main(String[] args) {
        new Hello();
    }
    public void Hello() {
        System.out.println("Hello!");
    }
}

This does not work, and I don't know why I can't access the Hello method. Thanks!

MCGuy
  • 137
  • 1
  • 9

1 Answers1

1

Hello method should be static and you call it by writing Hello(); in the main method.

Roxy
  • 132
  • 2
  • 9