mardi 4 août 2015

How do i use void with methods in Java?

public String firstMethod() {
    System.out.println("Hello!");
    return 'Done!';
}

and

public void secondMethod() {
    System.out.println("Hello!");
    return 'Done!';
}

Please, don't tell me "Void returns a value". Where does it return, how, and why do i need to use this? How can it be benefit from using?

Aucun commentaire:

Enregistrer un commentaire