上海继续教育JAVA作业1_第1页
上海继续教育JAVA作业1_第2页
上海继续教育JAVA作业1_第3页
上海继续教育JAVA作业1_第4页
上海继续教育JAVA作业1_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1、下面的程序经运行后,其输出结果是()public class yuedu1 public static void main(string args) int x,y; x=y=0; do y+; x*=x; while (x0)&(y5); system.out.println(y=+y+ x=+x); 选择一项:a. y=1 x=0 b. y=0 x=1 c. y=1 x=1 d. y=0 x=0 题目 2、java application中的主类需包含main 方法, main 方法的返回类型是什么?()选择一项:a. void b. double c. int d. floa

2、t 题目 3、不正确下列语句序列执行后,r 的值是 ( ) 。char ch=8; int r=10;switch( ch+1 ) case 7: r=r+3; case 8: r=r+5; case 9: r=r+6; break; default: r=r+8;选择一项:a. 15 b. 18 c. 16 d. 13 题目 4、不正确编译、运行下面代码将发生什么?()public class test5 public static void main (string args ) /* this is the start of a comment system.out.println(do

3、ne the test); /* this is another comment */ system.out.println (the end); 选择一项:a. 输出“ the end”。b. 输出“ done the test”。c. 程序运行出错。d. 输出“ done the test”和“ the end ”。题目 5、下面的程序经运行后,其输出结果是()public class yuedu1 public static void main(string args) int i; for(i=1;i6&810 题目 9 不正确3若 a和 b 均是整型变量并已正确赋值,正确的s

4、witch语句是 ( ) 。选择一项:a. witch( a+b*3.0 ) . b. switch(a+b); . c. switch ( a%b ) . d. switch a . 题目 10、java 源程序必须以()作为其扩展名选择一项:a. html b. exe c. java d. class 题目 11、不正确3下面代码段的运行结果()boolean flag = false; if (flag = true) system.out.println(true); else system.out.println(false); 选择一项:a. 没有信息输出b. true c. 出

5、错d. false 题目 12、不正确3下列方法定义中,正确的是()选择一项:a. void x( int a,int b ); return (a-b); b. x( int a,int b) return a-b; c. int x( int a,int b) return a+b; d. double x return b; 题目 13、不正确3string s1=new string(hello); string s2=new string(hello); system.out.print(s1=s2); system.out.print(, +s1.equals(s2); 选择一项:

6、a. false, true b. hello, hello c. hello, false d. hello, true 题目 14、不正确下面代码段的运行结果是()int i = 3; int j = 0; double k = 3.2; if (i 0) if(a3) c = 2; else c = 3; else c = 4; 选择一项:a. 3 b. 4 c. 1 d. 2 题目 18、 在 java编程中,以下()命令用来执行java 类文件。选择一项:a. 以上所有选项都不正确b. java c. javac d. appletviewer 题目 19、请问下面哪些代码行编译时会

7、出错?()选择一项:a. int i = 10; b. string s = 1; c. float f = 1.3; d. double d=4096.0; 题目 20、下面关于数组定义语句不正确的是()选择一项:a. int a2 ; b. float f =new 2.4f, 3.5f, 5.7f, 7.9f; c. double d =new double10; d. int a1 =1,2,3,4,5 题目 21、如果 int a=3,b=2,则执行 a*=b+8 后 a 的值为:()选择一项:a. 30 b. 14 c. 20 d. 16 题目 22、myprogram.java

8、被编译后,生成()。选择一项:a. myprogram.exe b. myprogram. bat c. myprogram. obj d. myprogram. class 题目 23、不正确3下面的 java 源文件代码片段是不正确的定义次序的是()选择一项:a. package testpackage;public class test /do something, b. import java.io.*; class person /do something, public class test /do something, c. import java.io.*; package t

9、estpackage; public class test /do something, d. import java.io.*; import java.awt.*; public class test /do something, 题目 24、不正确下面的程序经运行后,其输出结果是()public class yuedu4 public static void main(string args) system.out.print(fun(4); static int fun(int n) int t; if(n=0)|(n=1) t=3; else t=n*fun(n-1); return

10、 t; 选择一项:a. 24 b. 72 c. 36 d. 48 题目 25、如果定义有 double x ;float y;int m,则表达式 x*y-m 的类型为():选择一项:a. double b. float c. short d. int 题目 26、不正确3在一个应用程序中定义了数组a: int a=1,2,3,4,5,6,7,8,9,10, 为了打印输出数组a 的最后一个元素,下面正确的代码是()选择一项:a. system.out.println(a9); b. system.out.println(a10); c. system.out.println(aa.length

11、); d. system.out.println(a8); 题目 27、不正确3下面的说法错误的是()选择一项:a. java语言可以实现对内存垃圾自动收集b. java语言具有可移植性,是与平台无关的编程语言c. java语言编写的程序可以无须其运行环境便可“一次编译,到处运行”d. java语言是面向对象的、解释执行的网络编程语言题目 28、不正确3下列语句序列执行后,k 的值是 ( ) 。 int i=4,j=5,k=9,m=5; if(ij|mk) k+; else k-; 选择一项:a. 9 b. 8 c. 10 d. 5 题目 29、不正确3下面的程序经运行后,其输出结果是()public class yuedu3 public static void main(string args) int x,y; system.out.print(x1=+add(4,6); system.out.print(x2=+add(3,add(1,2); static int

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论