Java和C#般的性能 [英] Java and C#-like properties

查看:80
本文介绍了Java和C#般的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java的是否原生支持的属性,如C#?或在Java编码时,试图封装变量时,你被限制为做到这一点通过的getVariable() setVariable()还挺方法呢?

Does Java natively support properties, like C#? Or when coding in Java, when trying to encapsulate variables, you are constrained to do it by getVariable() and setVariable() kinda methods?

感谢

推荐答案

您没有属性的Java语言的概念。您需要使用getter和setter方法​​。

You don't have the concept of Properties in the Java language. You need to use getters and setters..

这篇关于Java和C#般的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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