标签:ar as new br class print public string 实例
public class Mugs {
Mug mug1;
Mug mug2;
{
mug1 = new Mug(1);
mug2 = new Mug(2);
}
Mugs() {
System.out.println("Mugs");
}
Mugs(int i) {
System.out.println("Mugs[i]");
}
public static void main(String[] args){
System.out.println("Inside main()");
new Mugs();
System.out.println("new Mugs() completed");
new Mugs(1);
System.out.println("new Mugs(1) completed");
}
}
class Mug {
Mug(int marker) {
System.out.println("Mug(" + marker + ")");
}
void f(int i) {
System.out.println("f(" + i + ")");
}
}
结果:
Inside main()
Mug(1)
Mug(2)
Mugs
new Mugs() completed
Mug(1)
Mug(2)
Mugs[i]
new Mugs(1) completed
标签:ar as new br class print public string 实例
原文地址:http://www.cnblogs.com/xingxiaofeng/p/4158435.html