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);}}}
内容
- 0
关于下面代码的说法()是正确的? publicclassExample{ publicstaticvoidmain(String[]args){ int[]arr=newint[10]; System.out.println(arr[1]); } }
- 1
请阅读下列的程序publicclassExample01{publicstaticvoidmain(String[]args){intnum=127;byteb=num;System.out.println(b);}}程序的运行结果是()
- 2
执行下列程序,输出结果为()。publicclassB{publicstaticvoidmain(String[]args){intx=5;doubley=10.5f;floatz=(float)(x*y);System.out.println(z);}}
- 3
(01-06) 关于Java应用程序的主方法,哪些声明是正确的?() A: publicstaticvoidmain(String[]args) B: staticpublicvoidmain(String[]args) C: publicstaticintmain(String[]args) D: staticintmain(String[]args) E: voidmain(String[]args) F: publicstaticvoidmain(Stringargs) G: publicstaticvoidmain(Stringargs[])
- 4
阅读下列的程序 publicclassTest3{ publicstaticvoidmain(String[]args){__________________________________________________}} classOuter{ staticclassInner{ publicvoidmethod(){ System.out.println(}}} 下列选项中,可以正确输出method()方法的是