What does void do in java?

You mean the tellItLikeItIs method? Yes, you have to specify void to specify that the method doesn’t return anything. All methods have to have a return type specified, even if it’s void.

It certainly doesn’t return a string – look, there are no return statements anywhere. It’s not really clear why you think it is returning a string. It’s printing strings to the console, but that’s not the same thing as returning one from the method.

Leave a Comment