Polymorphism is a special problem in the domain. I can not understand the Chinese version of the book directly called the domain, read the original English, the original writing is fields, direct translation Although correct, but the problem of the variable is not a domain. Specifically checked what's the meaning of field in Java? Many people think of it as a range enclosed in curly braces.
and find this post.
What's a field in Java?
A field is an attribute. A field may is a class ' s variable, an object's variable, an object ' s method ' s variable, or a parameter of a function.
Class bike{ static int bikes; int gear; int cadence; void Create (int newgear, int newcadence) { bikes = bikes + 1; Gear = Newgear; Cadence = newcadence;} int GetSpeed () { int speed = gear*cadence*5*3.141; return speed; }}
' Bikes ' is a class ' s variable (class variable) (static field).
The ' gear ' and ' cadence ' could is an object's variables (instance variables) (non-static fields).
' Speed ' was an object ' s method ' s variable (local variable).
' Newgear ' and ' newcadence ' are parameters of a function (parameters).
field, a field is a property that can be a class variable, an object variable, an object method variable, or a parameter to a function. (Supplemental, class's variables, instance variables and static variables of classes are called class ' s variables, generic variables, also known as class variables or data fields, actually translated into properties can also, class properties, sounds not weird, from Baidu Encyclopedia).
Class bike{ static int bikes; int gear; int cadence; void Create (int newgear, int newcadence) { bikes = bikes + 1; Gear = Newgear; Cadence = newcadence;} int GetSpeed () { int speed = gear*cadence*5*3.141; return speed; }}
Bikes is a class variable (static field).
Gear and Cadence are object variables (instance variables) (non-static domains).
(Here is a little bit of a contradiction, in fact, according to the encyclopedia, so bikes, gear and cadence are class variables, bikes is a static variable in the class variable, and gear and cadence are the instance variables in the class variable.) )
Speed is the variable (local variable) of the object method.
(see no, local Variable,java does not appear gobal variable, global variables, to say that the scope of the class variable is the same as the global variable, but not called).
Newgear and Newcadence are parameters (parameters) of a function (method).
Original address: Http://www.answers.com/Q/What_is_a_field_in_java
What are the domains in Java?