查题网
高校
Java程序设计
截止02-06,该科目累计收录道题目。
返回课程列表
在编写Java Applet程序时,需在程序的开头写上( )语句。A、import java.awt.Graphics ;B、import java.io.* ;C、import java.awt.* ;D、import java.applet.Applet ;
查看答案
正确率:100%
2021-03-27 00:18:25
读下面程序,给出编号语句的注释,最后屏幕输出结果。public class Assign { public static void main (String args[ ]) { int x, y; //1 float z=3.414f ; //声明并赋值float型变量 double w=3.1415; //声明并赋值double型变量 boolean truth=true; //声明并赋值boolean型变量 char c; //声明字符变量 String str; //2 String str1="bye"; //声明并赋值string类变量 c='A'; //3 str="Hi out there"; //给string变量赋值 x=6; y=1000; //给int型变量赋值System.out.println("x="+x); System.out.println("y="+y); System.out.println("z="+z); System.out.println("w="+w); System.out.println("truth="+truth); System.out.println("c="+c); System.out.println("str="+str); System.out.println("str1="+str1); }}
查看答案
正确率:70%
2021-03-24 04:57:00
请给出以下程序的输出结果。public class TestArray{ public static void main(String args[ ]){ int i , j ; int a[ ] = { 5,9,6,8,7}; for ( i = 0 ; i < a.length-1; i ++ ) { int k = i; for ( j = i ; j < a.length ; j++ ) if ( a[j]<a[k] ) k = j; int temp =a[i]; a[i] = a[k]; a[k] = temp; } for ( i =0 ; i<a.length; i++ ) System.out.print(a[i]+" "); System.out.println( ); }}
查看答案
正确率:60%
2021-03-24 02:42:00
分析下面代码执行后,写出正确的输出结果。 public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } 在 main 方法中有以下代码: Test test = new Test(); test.aMethod();
查看答案
2021-02-23 16:44:19
以下程序可否编译通过,如果不能,请指出其错误.public class Forest implements Serializable{ private Tree tree = new Tree();, public static void main(String[] args){ Forest f = new Forest(); try{ FileOutputStream fs = new FileOutputStream(Forest.Ser); ObjectOutputStream os=new FileOutputStream(fs); os.writeObject(f); os.close(); }catch(Exception ex){ ex.printStackTrace(); } }}Public class Tree{}
查看答案
2021-02-23 16:42:19
写出下面程序的运行结果import java.io.* ; public class abc { public static void main(String args[ ]) {System.out.println("a="+a+"\nb="+b); } } class SubClass extends SuperClass { int c; SubClass(int aa, int bb, int cc) { super(aa, bb); c=cc; } } class SubSubClass extends SubClass { int a; SubSubClass(int aa, int bb, int cc) { super(aa, bb, cc); A = aa+bb+cc; } void show() { System.out.println("a="+a+"\nb="+b+"\nc="+c); } }
查看答案
2021-02-23 16:40:19
写出下面程序的运行结果 import java.io.* ; public class abc { public static void main(String args[ ]) { int i, s = 0 ; int a[ ] = { 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 }; for ( i = 0 ; i < a.length ; i ++ ) if ( a[i]%3 = = 0 ) s += a[i] ; System.out.println("s="+s); } }
查看答案
2021-02-23 16:39:19
请给出以下程序的输出结果。class StringTest1{ public static void main(String[] args) { String s1=hello; String s2=new String(hello); if(s1.equals(s2)){ System.out.println(相等); }else{ System.out.println(不相等); } }}
查看答案
2021-02-23 16:39:19
请给出以下程序的输出结果。class StringTest1{ public static void main(String[] args) { String s1=hello; String s2=new String(hello); if(s1.equals(s2)){ System.out.println(相等); }else{ System.out.println(不相等); } }}
查看答案
2021-02-23 16:39:19
请给出以下程序的输出结果。 class StringTest1 { public static void main(String[] args) { String s1=hello; String s2=new String(hello); if(s1.equals(s2)){ System.out.println(相等); }else{ System.out.println(不相等); } } }
查看答案
2021-02-23 16:38:19
首页
上一页
...
79
80
81
(current)
82
83
...
下一页
尾页