摘要: 1.Distinguishing overloaded methodsIf the methods have the same name, how can Java know which method you mean?There is a simple rule: Each overloaded method must take a unique list of argument types.2.Overloading on return valuesIt is common to wander,"Why only class names and methods arguments 阅读全文
posted @ 2013-01-16 16:37 siyusiying 阅读(99) 评论(0) 推荐(0) 编辑
摘要: The relational operators == and != also work with all objects,but their meaning often cunfuses the first-time java programmer.Here's an example:public class Equivalence { public static void main (Sting[] args){ Integer n1 = new Integer(47); Integer n2 = new Integer(47); System.out.println(n1 == 阅读全文
posted @ 2013-01-16 11:21 siyusiying 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1 In a good object-oriented design, each object dose one thing well, but doesn't try to do too much.2 Code reuse is one of the greatest advantages that object-oriented programming languages provide.3 To override a method,you simply create a new definition for the method in the derived class.You 阅读全文
posted @ 2013-01-09 16:49 siyusiying 阅读(109) 评论(0) 推荐(0) 编辑