0
Does It must have the state private or public??
When you declare a method first visibility, second type of return value and then the Name and the args
4 odpowiedzi
+ 4
Pls clarify what u want to know dude.
+ 2
U have to calrify it according to ur use,suppose if u want a method to be access from outside a class u have to make it public , if u didn't clarify than it is private by default.
Void means the method is not returning any value u have to write this whenever u create a method if it returning anything or if it is not.
Byt incase of constructor u are free ,u don't need to use void because a constructor has no return type.
I hope u get what i want to say.
0
in a method When you write it Do you have to specify the visibility
Example: public int max()
also? -> void hello()