- 博客(6)
- 收藏
- 关注
转载 接口回调
接口回调是指:可以把使用实现了某一接口的类创建的对象的引用赋给该接口声明的接口变量,那么该接口变量就可以调用被类实现的接口的方法。实际上,当接口变量调用被类实现的接口中的方法时,就是通知相应的对象调用接口的方法,这一过程称为对象功能的接口回调。看下面示例。 interface People { void peopleList(); } class Student implements
2010-03-19 15:45:00
294
转载 经典小代码
/** * 打印九九乘法口诀表 */ public void nineNineMulitTable(){ for (int i = 1,j = 1; j System.out.print(i+"*"+j+"="+i*j+" "); if(i==j){ i=0;
2010-03-19 15:44:00
251
转载 值传递和引用传递
public class Foo { public static void main (String [] args) { StringBuffer a = new StringBuffer ("A"); StringBuffer b = new
2010-03-19 15:43:00
184
转载 数组顺序的排列
public class TestSort { public static void main(String args[]) { int[] a = { 1, 7, 3, 9, 2, 5, 8, 4, 6 }; // bubbleSort(a); // selectionSort(a); bubbleSort(a); for (int i = 0; i System.out.pri
2010-03-19 15:43:00
244
转载 子类与父类的初始化问题
class Parent{ int x=10; public Parent(){ add(2); } void add(int y){ x+=y; } } class Child extends Parent{ i
2010-03-19 15:38:00
291
转载 自增运算与自减运算
1. 自增运算符(Increment Operator) 自增运算符 ++ 使操作数的值增 1,其操作数必须为可变左值(您可以简单地把可变左值理解为变量)。++ 可以置于操作数前面,也可以放在后面。例如: ++n ; n++ ;这两个语句产生的结果都是使 n 增 1,可以说没什么区别。使用以下语句得到的效果也是一样的: n = n +
2010-03-19 15:37:00
464
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人