第二,静态方法是全局可用的。
正号(+)表明一个类或静态方法。
需要使用静态方法有两个重要原因。
There are two good reasons why you might want to use a static method.
在静态方法m中非法引用t的错误。
An error for the illegal reference to t inside static method m.
流程工程师在静态方法中标识扩展点。
The process engineer identifies extension points in a static method.
此代码定义为watchit类的静态方法。
This code is defined as the static method of the watchit class.
你只需使用类中的静态方法就可以完成想要的功能。
图4:swing类中的方法的静态方法时序图。
Figure 4: a static method Sequence diagram for a method in a Swing class.
扩展类是一个静态类有一个静态方法。
The class Extensions is a static class that has a static method.
转换静态方法为扩展方法。
Convert Static to Extension Method Introduce Variable Use Base Type where possible.
静态方法具有一些缺点。
其他任意对象上的静态方法或实例方法。
此特性的目标必须是一个方法或静态方法。
The target of this attribute must be either a method or a static method.
事实上,静态方法有时可能会带来不同的缺陷。
In fact, the static approach may sometimes create a different vulnerability!
在同一个类中,相同的前缀可以引用多个不同的静态方法。
The same prefix can reference several different static methods in the same class.
那个方法既可以是静态方法,也可以是实例方法。
That method can be either a static method or an instance method.
如果更愿意采取面向对象的方式,可以使用相应的静态方法。
If you prefer the object-oriented approach, you can use the corresponding static method.
这是静态方法。
如果你没必要访问对象的字段,那么使你的方法成为静态方法。
If you don't need to access an object's fields, make your method static.
has_many是一个静态方法调用,符号:items是它的参数。
Has_many is a static method call for which the symbol: items is a parameter.
这段代码的第一部分再次检查方法是否是静态的。
The first part of this piece again checks whether the method is static.
它有一个静态搜索方法,并充当一个数据模型。
更具体地说,这个任务由它的静态sendMail方法负责完成的。
More specifically, its static sendMail method is responsible for the effort.
使用静态工厂方法创建一个msg对象。
使用“静态”方法,可以编写如下的函数。
通过这种方法,您可以运行简单的、静态链接的Linux应用程序。
In this way, you can run simple, statically-linked Linux applications.
如何获得上下文在我自己的方法或静态块吗?
但如果你的树是静态的,没有必要重写此方法。
But if your tree is static, there is no need to override this method.
下一章会有做静态单元测试的更好的方法。
Check out the next chapter on a better way to do static unit tests.
下一章会有做静态单元测试的更好的方法。
Check out the next chapter on a better way to do static unit tests.
应用推荐