【计算机类职业资格】计算机二级JAVA-62及答案解析.doc

上传人:testyield361 文档编号:1338353 上传时间:2019-10-17 格式:DOC 页数:2 大小:27.50KB
下载 相关 举报
【计算机类职业资格】计算机二级JAVA-62及答案解析.doc_第1页
第1页 / 共2页
【计算机类职业资格】计算机二级JAVA-62及答案解析.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、计算机二级 JAVA-62及答案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1.本程序将字符串 str中的字符a用$符号代替,然后将字符串中第一个$字符前的所有字符去掉,并打印输出最后的 str字符串。 public class exam_64 public static void main(String args) String str=“Iamagoodboy, andwhataboutyou?“; str=_; int pos=_; str=_; System.out.println(str); (分数:30.00)_2.本程序将

2、字符串 str(“Welcome to China!“)转化为一个字符数组 c,然后将字符数组按数组下标逆序输出。 public class exam_65 public static void main(String args) String str=“Welcome to China!“; char c; _; _; int i; for(_) System.out.print(ci); (分数:30.00)_3.本程序生成一个大小为 200200的窗口,并将窗口的背景色设为黑色。 import java.awt.*; public class exam_66_ public static

3、 void main(String args) exam 66 fr=new exam_66(); _; _; fr.setVisible(true); (分数:40.00)_计算机二级 JAVA-62答案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1.本程序将字符串 str中的字符a用$符号代替,然后将字符串中第一个$字符前的所有字符去掉,并打印输出最后的 str字符串。 public class exam_64 public static void main(String args) String str=“Iamagoodboy,

4、 andwhataboutyou?“; str=_; int pos=_; str=_; System.out.println(str); (分数:30.00)_正确答案:(str.replace(a, $) str.indexOf(“$“) str.substring (pos)解析:2.本程序将字符串 str(“Welcome to China!“)转化为一个字符数组 c,然后将字符数组按数组下标逆序输出。 public class exam_65 public static void main(String args) String str=“Welcome to China!“; ch

5、ar c; _; _; int i; for(_) System.out.print(ci); (分数:30.00)_正确答案:(c=new charstr.length() str.getChars(0, str.length(), c, 0) i=c.length-1; i=0; i-)解析:3.本程序生成一个大小为 200200的窗口,并将窗口的背景色设为黑色。 import java.awt.*; public class exam_66_ public static void main(String args) exam 66 fr=new exam_66(); _; _; fr.setVisible(true); (分数:40.00)_正确答案:(extends Frame fr.setSize (200, 200) fr.setBackground (Color.black)解析:

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 考试资料 > 职业资格

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1