他们有C#静态类Java中的相同呢? [英] Do they have the equivalent of C# static classes in Java?

查看:282
本文介绍了他们有C#静态类Java中的相同呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

他们有C#静态类相当于在Java中?

Do they have the equivalent of C# static classes in Java?

我想创建一个C#静态类,但在Java中,我怎么办呢?

I want to create a C# static class but in Java, how do I do it?

感谢您的帮助。

编辑:谢谢你的帮助球员。 :)

Thanks for the help guys. :)

推荐答案

有静态成员的Java类,但没有静态类,就像在C#

There are static members in Java classes, but no static class, like in C#.

C#的静态类修饰符并没有真正改变什么关于类,从使用的角度来看,虽然。它只是阻止你,在编译的时候,从增加实例变量。

The C# static class modifier doesn't really change anything about the class, from a usage standpoint, though. It just prevents you, at compile time, from adding instance variables.

您可以在Java的一个类,它会像一个C#静态类由刚刚宣布每一个成员作为静态的。请参阅理解实例和类成员教程一节。

You can make a class in Java that would work like a C# static class by just declaring every member as static. See the tutorial section on "Understanding Instance and Class Members" for details.

这篇关于他们有C#静态类Java中的相同呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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