+ 3
Java public static void order
public class Program { public void static main(String[] args) { System.out.println("hi"); } } this gives an error while public class Program { public static void main(String[] args) { System.out.println("hi"); } } this works perfectly fine so does that means the order of public static void matters?? bcoz i thought i didnt.
5 Réponses
+ 8
As the error message said, return-type required. In a method signature (and definition), scope and access definition comes first, and return type specifier should be written nearest to the method name. `static` is unknown as return type, it is an access modifier. So `void` naturally be the return type for that sample, and should be placed near by the method name to define the method return type.
+ 2
oh thanks I understand now .
+ 2
in java everything must be inside class public means this class is public everyone can access it static means this works without creating an object of the class void means it doesnt returns anything
+ 1
Hello, I don't know what's the meaning of " class, public, static , void,main(),string,args ". can anybody explain these terms crystal clear? And also i don't know why they written in such a order? And I read the tutorials but I didn't understand.
+ 1
ask ur question on discuss other people with more knowledge willl help you