void
in Java means, that the method does not return anything.Here's an example:
public class Person {
private String name;
public Person(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void sayHello() {
System.out.println("Hello!");
}
}
Person jane = new Person("Jane");
jane.sayHello(); // Hello!
System.out.println(jane.getName()); // Jane
// error: 'void' type not allowed here
// (because sayHello does not return anything)
System.out.println(jane.sayHello());