top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

+3 votes
415 views
What if I write static public void instead of public static void?
posted Jan 19, 2017 by Dhaval Vaghela

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Yes can write static public void instead of public static void. Consider the following example,

package com.vini.sample;

public class Sample {
    public static void main(String[] args) {
        System.out.println("Welcome to Queryhome.com");
    }
}

package com.vini.sample;

public class Sample {
    static public void main(String[] args) {
        System.out.println("Welcome to Queryhome.com");
    }
}

Above two examples working fine. Both sample programs gives same output i.e.,
Welcome to Queryhome.com

answer Jan 28, 2017 by Vinni Fernandis
Similar Questions
+2 votes

Hai,friends if you are know the difference means tell me

+1 vote

What is the difference between

public static void Main()

and

private static void Main()

in C#?

+4 votes

Why can’t we use a static class instead of singleton?

...