阅读下列程序,请写出该程序的功能。 import java. util.*; public class Class1{ public static void main(Srting args[]){ Date date1=new Date(); System. out. println (datel); String t=datel.toString(); int endPos=t.indexOf(`C'); t=t.substring(11,endPos); System. out println(t); } }
举一反三
- 中国大学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”) ; } }
- 智慧职教: 阅读下列代码public class Person{ static int arr[ ] = new int[10]; public static void main(String args) { System. out. println(arr[9]) ; }}该代码的运行结果是_________。
- 写出下面程序的输出( )。 public class Test { public static void main (String args[ ]) { iht x=1, y=2; System. out. println ("result="+x+y); System. out. println ("result="+(x+y)); A.result=12 result=12 B.result=3 result=3 C.result=3 result=12 D.result=12 result=3
- 请写出下列程序的输出结果。class A{public int f(int x) {return x+1;}}class B extends A{public int f(int x){return x*x;}}public class E{public static void main(String args[]){A a=new B();int m=a.f(10);System. out. println(m) ;}}
- 【单选题】对于下面代码,正确的Java源程序文件名是( )。 class A { void method1() { System. out .println( "Method1 in class A" ); } } public class B { void method2() { System. out .println( "Method2 in class B" ); } public sta