没有。
这就是Java具有getter / setter的原因。
在C#中,您通常会有类似以下内容:
public class SomeObject{ private string _title = ""; public string Title { get { return _title; } set { _title = value; } }}// Or with Auto-Propertiespublic class SomeObjectAutoProperties{ public string Title { get; set; }}Java getter / setter等效项为:
public class SomeObject{ private String _title = ""; public string getTitle() { return _title; } public void setTitle(String value) { _title = value; }}


