+ 2

why should we use "static void" for method declaration?

23rd Jul 2016, 4:51 PM
Dhana sri sowmya avidi
Dhana sri sowmya avidi - avatar
4 Answers
+ 2
static methods are binded with the class anf to call these methods no need to create the object of class. these methods can be called directly by using class name
23rd Jul 2016, 7:43 PM
Pravin Sable
Pravin Sable - avatar
+ 1
just do it, later u will see all other types of instance methods with return tupes... static -> a lot info in course and on forum void -> method doesn't return anything to caller
23rd Jul 2016, 4:56 PM
Petar Suvajac
Petar Suvajac - avatar
+ 1
okay thanks..
25th Jul 2016, 4:05 PM
Dhana sri sowmya avidi
Dhana sri sowmya avidi - avatar
+ 1
You just asked two questions which are... 1. why should we use "static", and 2. why should we use "void" keywords... Answers 1. you use static to avoid instantiating the class with the "new" keyword before accessing the property or method 2. You use void to specify that the method returns nothing or the "return" keyword wasn't used at all in the method. I hope it helps..
17th Nov 2016, 10:27 AM
Toheeb
Toheeb - avatar