举一反三
- 下列Java源文件代码片段中,( )是正确的。 A: package t;public class A{} B: import java.io.*;package t;public class A{} C: import java.io.*;class A{}public class B{} D: import java.io.*;import java.awt.*;public class A{}
- 下列哪个选项的java源文件代码片段是不正确的( )。 A: package mypackage; public class Test{ } B: import java.io.*; class Person{ } C: C. import java.io.*; package mypackage; public class Test{ } D: import java.io.*;import java.awt.*;public class Test{ }
- 下面哪些代码段是正确的Java源程序? A: package testpackage; public class Test{//do something...} B: import java.io.*; package testpackage; public class Test{// do something...} C: import java.io.*; class Person{// do something...} public class Test{// do something...} D: import java.io.*; import java.awt.*; public class Test{// do something...}
- 下面哪些代码段是正确的Java源程序?( ) A: import java.io.*; package testpackage; public class Test{/* do something... */} B: import java.io.*;class Person{/* do something... */}public class Test{/* do something... */} C: import java.io.*; import java.awt.*; public class Test{/* do something... */} D: package testpackage;public class Test{/* do something... */}
- 下面哪个代码片段是错误的? A: package mypackage;public class Rectangle{//doing something…} B: import java.io.*;package mypackage;public class Rectangle{//doing something…} C: import java.io.*;class Circle{//doing something…}public class Rectangle{//doing something…} D: import java.io.*;import java.awt.*;public class Rectangle{//doing something…}
内容
- 0
阅读以下程序,输出结果为_______。 import java.iO.*; public class abc { public static void main(Stringargs[]) { String sl="Hello!"; String s2=new String("I like Java!"); System.out.println(s1+""+s2); }
- 1
下面代码的运行结果为:( ) import java.io.*; import java.util.*; public class foo{ public static void main (String[] args){ String s; System.out.println("s=" + s); } }
- 2
下列程序的运行结果是 ______ 。 import java.io.*; public class abc public static void main(String args[]) String s1="Hello!”; System.out.println(s1.to UpperCase());
- 3
写出下面程序的运行结果 【15】 import java.io.*; public class abc public static void main(String args[]) String s1="Hello!"; String s2=new String("World!"); System.out.println(s1.concat(s2));
- 4
下面程序段中不正确的是( )。 A: package myPackage;public class A{} B: package myPackage; class B{ } C: package myPackage; import java.io.*; public class C{ } D: import java.awt.Color; package myPackage; class D{ }