我知道这个问题类似于其他关于Java属性的问题,那些问题的答案似乎是“不,你必须使用getter/setter”。
我搜索了类似于C#的Java属性,但目前只找到一个“命中”。而且我不确定它是属性还是其他什么东西。
在阅读Java教程时,我遇到了一些文本和代码,其中说(**强调和我的评论):
我搜索了类似于C#的Java属性,但目前只找到一个“命中”。而且我不确定它是属性还是其他什么东西。
在阅读Java教程时,我遇到了一些文本和代码,其中说(**强调和我的评论):
Finally, you can use the built-in **length property** to determine the
size of any array. The code:
//notice lack of brackets after anArray.length :
System.out.println(anArray.length);
will print the array's size to standard output.
由于Array
具有length
属性,Java确实有属性,对吗?
有人可以指出一些相关文档吗?