????????
????Java????????????????4??
????1. Instance Variables: (Non-Static Fields) ???????????field
????2. Class Variables: (Static Fields) ???????field
????3. Local Variables: ???????
????4. Parameters: ????
?????????????????????field??variable??field????????1??2????class??械????????field???????variable??????????3??4???????????????variable??
????????
????Java??????????写???????????????????????java??????????????????????????????????????????????????????????????????写?????纾� speed?? currentGear
???????????????? Primitive Data Type
????Java??8??????????????
?????????? 4???? byte?? short?? int?? long
???????? 2???? float?? double
??????? 1???? char
???????? 1???? boolean
??????????????????锟�?

???????? Default Value
??????????谐??????????????????c/c++????????????????java???????????????????????
????The eight primitive data types are: byte?? short?? int?? long?? float?? double?? boolean?? and char. The java.lang.String class represents character strings. The compiler will assign a reasonable default value for fields of the above types; for local variables?? a default value is never assigned. A literal is the source code representation of a fixed value. An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation?? its length is fixed.
?????????Field?????????????????????int???0??object???null????????Variable??????????????????????谐????????????????