java程序设计答案

2026/1/18 6:02:32

2、下列代码的执行结果为: public class Test {

public static void main(String[] args) { String s1=new String(\

String s2=new String(\System.out.println(s1==s2);

System.out.println(s1.equals(s2)); } }

3、给出下列程序的输出结果:

public class ex23{

public static void main(String[ ]args){ float x=5; float y=5; double c=10; c%=(++x)*y;

System.out.println(x); System.out.println(c);

} }

4、下列代码的执行结果为: public class ex23{

public static void main(String[ ]args){ int x=12; int m=11; int y=13;

int temp=x>y?x:y;

System.out.println(temp);

temp=temp>m?temp:m; System.out.println(temp); } }

5、public class test1{

public static void main(String[]args) {

for(int cnt=0;cnt<10;cnt++) {

if (cnt==5) break;

System.out.print(cnt); } } }

四、编程题 1、编写程序,求

?kk?1102的值。.

2、编写打印下列图形的程序。

%

% % % % % % % % % 3、有一函数:

x (x<1) y = 3x-2 (1≤x<10) 4x (x≥10)

编写一程序,x值通过键盘输入,输出y值。

4、编写打印下列图形的程序:(10分)

* * * * * * * * * * * * * * * *

5、编写一程序,查找某一字符串是否包含有 “abc”。 6、3、考虑一个2×3的数组a。(20分)

(1) 为a写一个声明。试问,这样的声明使a有多少行,多少列,多少元素? (2) 写出a 的第1行的所有元素的名字。 (3) 写一条语句,置行1列2的元素为零。

(4) 写一个嵌套for结构,将a 的每个元素初始化为零。 (5) 写一条语句,求第3列元素的和。

7、编写程序,打印三角形状的九九乘法表,要求使用break或continue语句。(20分)


java程序设计答案.doc 将本文的Word文档下载到电脑
搜索更多关于: java程序设计答案 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219