Person p1 = new Person();Person p2 = p1;这两句代码创建了【】个对象
举一反三
- Person p1 = new Person(18); //Person是引用类型 Person p2 = p1; 如果 p1.age=35; 则 p2.age也是35
- 通过Person类创建对象p的代码是____
- 阅读下面的代码: class Person{ void say(){ System.out.println("hello"); } } class Example{ public static void main(String[] args){ Person p1 = new Person(); Person p2 = new Person(); p2.say(); p1.say(); p2=null; p2.say(); } } 下列选项中,哪个是程序的输出结果?()
- #include "stdio.h" main( ) { int a,b,*p1,*p2,*p; a=1;b=2; p1=&a; p2=&b; if(a
- 请阅读下面的程序代码,选择正确的运行结果 Class Person{ void say(){ System.out.println(“hello”); } } class Example{ public static void main(String[] args){ Person p2 = new Person(); Person p1 = new Person(); p1.say(); p2.say();} }