Make a method that displays Holamundo in JAVA

Have sent us an exercise of creating with a Holamundo method. I have this code but it doesn't work for me... I have no idea how to throw, can you correct me? Please and thank you very much.

    package tema2;

public class holamundo {
    public void holamundo(){    
        System.out.println("HolaMundopuntocom ");
    } 
    public static void main(String[]args) {
       holamundo(); 
    }
}
 0
Author: Hechi, 2016-10-07

1 answers

Here you have it;)

package javaapplication2;


public class JavaApplication2 {

    public static void holamundo(){
        System.out.println("Hola Mundo");}
    public static void main(String[] args) {
        holamundo();
    }

}

The problem in your code is that you can't call a non-static method from a static one.

 4
Author: Sergio Cv, 2016-10-07 10:32:58