Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

sealed class PI
{
  public static float number;
  static PI()
  { number = 3.141592653F; }
  static public float val()
  { return number; }
}
  1. What's the difference between public static and static public? Can they be used in any order?

  2. How would I use static public float val()?

    Does it get executed as soon as the class is initialized?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
163 views
Welcome To Ask or Share your Answers For Others

1 Answer

There's no difference. You're free to specify them in either order. However, I find that most developers tend to use public static and not static public.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...