以下代码运行输出是()classMan{
privateStringname=Jack;
intage=30;}publicclassManTest{
publicStringtel;
publicstaticvoidmain(String[]args){
Manm=newMan();
System.out.println(m.name);
}}
privateStringname=Jack;
intage=30;}publicclassManTest{
publicStringtel;
publicstaticvoidmain(String[]args){
Manm=newMan();
System.out.println(m.name);
}}
举一反三
- 给出程序的运行结果() classPerson{ Stringname; intage; Person(){ System.out.println('Person()'); } voidPerson(){ System.out.println('method()'); } publicvoidtell(){ System.out.println('姓名:'+name+',年龄:'+age); } } publicclassClassTest02{ publicstaticvoidmain(String[]args){ Personperson=newPerson(); person.name='张三'; person.age=30; person.tell(); } }
- 以下代码运行输出是()class Man {private String n...println(m.name);}}
- 中国大学MOOC: 下列代码中构造方法的返回类型是()public class Village { Village () { System .out .println(“hiding in Village”) ; } public static void main( String args [ ]) { Village c =new Village ( ) ;}class Village { public static void main( String args [ ]) { Village c =new Village ( ) ; } Village () { System .out .println(“hiding in Village”) ; } }
- 以下哪个是有效的Java程序入口函数? A: publicstaticvoidmain(String[]args); B: publicstaticvoidmain(); C: publicstaticintmain(String[]args); D: publicstaticvoidmain(intargc,String[]args)
- 下列程序编译并运行的结果为()publicclassTest{publicstaticvoidmain(String[]args){try{inti=1;System.out.println(i++);}finally{System.out.println(++i);}}}