answersLogoWhite

0


Best Answer

The order of modifiers makes no difference; they mean exactly the same thing.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What happens if you write static public void instead of public static void?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What if you write static public void instead of public static void?

It would actually make no difference. The presence of the keywords during the declaration of the main method is important and not the order. so a static public void main(String[] args) would just compile and run perfectly fine just like public static void main(String[] args)


Why not write static public void main?

You can write. The order of these words does not make any difference.


How to Write a java program to display hello?

public class Hello{public static void main(String [] args){System.out.println("Hello");}}


How many types can write public static void main in java?

You can write it in as many ways as you want. The words public, static and void can be interchanged during the method declaration and still the main() method will continue to work in the same way. i.e., public static void main(String[] args) is the same as static public void main(String[] args) However, if you miss either of these 3 keywords from the method signature, the compiler will still let you compile the method, but it just won't be the main method that can be used to start the program execution.


Write a program to show the concept of recursion in java?

public class Main{ public static void main(String[] args){ System.out.println("the factorial of 5 is: " + getFactorial(5)); } public static int getFactorial(int num){ return num + getFactorial(num-1); } }


What happens when you write Static word to a class or Methods?

there would just be one instance of the object no matter how many times you instantiate it.


Write a Java program to generate a copy of itself?

public class S{public static void main(String[]a){String o="public class S{public static void main(String[]a){String o=%c%s%c;System.out.printf(o,34,o,34);}}";System.out.printf(o,34,o,34);}}


Write a program to eliminate the blanks from string 8085?

public class RemoveSpace{ public static void main(String args[]){ String str = "8085"; Sysytem.out.println(str.trim()); } } Get The Desired OutPut....


How do you invoke static methods?

if some method is static, then you can not call that method through the oobject of that class. but the name of the class. let us see a example: class Test { int a; int b; static void show() { System.out.println("we are in show"); } } class Main { public static void main(String args[]) { Test t=new Test(); t.show();\\thiss is an erroraneous code. because, the method "show()" is static. Test.show();\\this is correct } Arnas Sinha


Is there any change by interchanging the position of main in Public static void main in java?

No. You can write it in as many ways as you want. The words public, static and void can be interchanged during the method declaration and still the main() method will continue to work in the same way. i.e., public static void main(String[] args) is the same as static public void main(String[] args) However, if you miss either of these 3 keywords from the method signature, the compiler will still let you compile the method, but it just won't be the main method that can be used to start the program execution.


Write a program that read and display double number?

class simple { public static void main(String[] args){System.out.println(new java.util.Scanner(System.in).nextDouble());} }


Write a java program to print first 50 palindrome numbers?

Just change the number assigned to P if you want a different number of palindromes: public class PalindromeNumbers { public static final int P = 50; public static void main(String[] args) { getNums(P); } public static void getNums(int n) { int count = 0, current = 1; while(count < n) { if(palindrome("" + current) { System.out.println(current); count++; } current++; } public static boolean palindrome(String s) { if(s.length() s.charAt(s.length - 1) return palindrome(s.substring(1, s.length - 2) else return false; } }