+ 1

Hello! Can someone tell me why you put public,void,static at the same time and bot oly one? Thank you

8th Jul 2018, 6:30 PM
edward barriere
3 odpowiedzi
+ 2
You don't have to put all of them together. They have different uses. public declares the method as public, so it can be accessed in whatever scope the object is declared in. void means there's isn't a return. static means that member/method is shared throughout all instances of the class. EDIT: Oops, I didn't realize this was for Java, I thought it was for C++. I'd imagine it still applies.
8th Jul 2018, 6:43 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 2
Ben Allen (Njinx) you are right, it still applies. They have same meaning in java and c++ both.
8th Jul 2018, 7:08 PM
Dhruv garg
Dhruv garg - avatar
0
tank you too much!
8th Jul 2018, 7:33 PM
edward barriere