Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 457 Bytes

void.md

File metadata and controls

25 lines (20 loc) · 457 Bytes

void

All methods have to declare some return type. void is what you write when a method won't return any value.

// Returns a String
String title() {
    return "All Night";
}

// Returns an int
int views() {
    return 4071;
}

// Doesn't return any value.
void talkAboutVideo() {
    System.out.println(title() + " only has " + views() + " views.");
}

// This is what the void in "void main()" means
void main() {
    talkAboutVideo();
}