Always keep data private.This is first and foremost: doing anything else violates encapsulation. You may need to write an accessor or mutator method occasionally, but you are still better off keeping ... Read More
posted @ 2010-09-13 13:41
露初晞
Views(172)
Comments(0)
Diggs(0)
The main reason for using packages is to guarantee the uniqueness of class names.Static ImportsFor example, if you add the directiveto the top of your source file, then you can use static methods and ... Read More
posted @ 2010-09-13 13:31
露初晞
Views(198)
Comments(0)
Diggs(0)
Calling Another ConstructorIf the first statement of a constructor has the form this(. . .), then the constructor calls another constructor of the same class. Here is a typical example:When you call n... Read More
posted @ 2010-09-13 13:11
露初晞
Views(169)
Comments(0)
Diggs(0)
Static FieldsIf you define a field as static, then there is only one such field per class. In contrast, each object has its own copy of all instance fields.class Employee{ . . . private int id; privat... Read More
posted @ 2010-09-13 12:36
露初晞
Views(275)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号