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分)

