中国大学MOOC: 运行以下代码:public class SqrtExample{public static void main(String[] args){ double value=-9.0; System.out.println(Math.sqrt(value)); }}运行结果是( )。
举一反三
- 中国大学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”) ; } }
- 中国大学MOOC: 运行以下代码:public class StringRef{public static void main(String[] args){ String s1=”abc”; String s2=”def”; String s3=s2; s2=”ghi”; System.out.println(s1+s2+s3);}}运行结果是( )。
- 读代码:public class foo {static String s;public static void main (String[]args) {System.out.println (“s=” + s);}}结果是
- 运行下面程序段的结果是:( )。 public class MyMain{ public static void main(String args){ System.out.println(“Hello Java”); } }
- (2-5)写出下面程序运行结果。 public class Demo { public static void main(String args[]) { System.out.println(123); System.out.println(0123); System.out.println(0x123); } }