就在这里。变量可以是局部变量,字段变量或常量变量(尽管从技术上讲这是错误的)。像属性一样模糊。另外,您应该知道有些人喜欢调用最终的非静态(局部或实例)变量“ 价值观 ”。这可能来自新兴的JVM FP语言,例如Scala。字段通常是实例类上的私有变量。这并不意味着有一个getter和setter。属性是一个模糊的术语。它很容易与XML或Java Naming API混淆。尽量避免使用该术语。属性是getter和setter的组合。下面的一些例子public class Variables { //Constant public final static String MY_VARIABLE = "that was a lot for a constant"; //Value final String dontChangeMeBro = "my god that is still long for a val"; //Field protected String flipMe = "wee!!!"; //Property private String ifYouThoughtTheConstantWasVerboseHaHa; //Still the property public String getIfYouThoughtTheConstantWasVerboseHaHa() { return ifYouThoughtTheConstantWasVerboseHaHa; } //And now the setter public void setIfYouThoughtTheConstantWasVerboseHaHa(String ifYouThoughtTheConstantWasVerboseHaHa) { this.ifYouThoughtTheConstantWasVerboseHaHa = ifYouThoughtTheConstantWasVerboseHaHa; }}还有更多的组合,但是我的手指很累:)