上一页 1 ··· 6 7 8 9 10
  2007年3月8日
摘要: 以下代码为例: 1public class Sample 2{ 3 public static void main(String [] args) 4 { 5 A a = new B(); //父类A引用子类B的实例 6 if(a instanceof B) 7 System.out.println("对象 a 是类 B 的实例"... 阅读全文
posted @ 2007-03-08 00:08 豆豆の爸爸 阅读(1908) 评论(2) 推荐(0)
  2007年3月5日
摘要: 我们再来看看下面这个例子。ShadowTest.java 1public class ShadowTest 2{ 3 public static void main(String [] args) 4 { 5 A a = new A(); 6 B b = new B(); 7 System.out.println("a.i= "+a.i); ... 阅读全文
posted @ 2007-03-05 00:20 豆豆の爸爸 阅读(277) 评论(0) 推荐(0)
  2007年3月4日
摘要: A.java 1class A2{3 int i;4 A()5 {6 i=10;7 System.out.println("调用父类构造方法");8 }9} B.java 1public class B extends A 2{ 3 int j; 4 B() 5 { 6 j=20; 7 System... 阅读全文
posted @ 2007-03-04 20:23 豆豆の爸爸 阅读(327) 评论(0) 推荐(0)
  2007年2月27日
摘要: 在C#语言中比较相等可用“==”运算符与“Equals()”方法,下面的示例代码是两个string类型相比较是否相等: string str1 = "abc"; string str2 = "abc"; Console.WriteLine(str1 == str2); Console.WriteLine(str1.Equals(str2)); 结果皆为True。Equals()方法比“==”运算符... 阅读全文
posted @ 2007-02-27 00:05 豆豆の爸爸 阅读(377) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10