公共静态VS静态公共 - 是有区别吗? [英] public static vs static public - is there a difference?

查看:90
本文介绍了公共静态VS静态公共 - 是有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 密封类PI 
{
公共静态浮点数;
静态PI()
{数= 3.141592653F; }
静态的公众持股量VAL()
{返回数; }
}




  1. 什么是公众之间的区别静态和静态公共?他们能在任何顺序使用?


  2. 我将如何使用静态公众持股量VAL()



    是否得到尽快类初始化执行?



解决方案

那么,它就像一个人的呼叫汤姆·麦克或麦克汤姆,没有区别的名称=)


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?

解决方案

Well, it is just like the name of a Person =) Calling Tom Mike or Mike Tom, no difference.

这篇关于公共静态VS静态公共 - 是有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆