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

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

1、计算机二级 JAVA-46及答案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1.本程序计算三个数(1234、456、-987)中的最大数并输出结果。 public class exam_4 public static void main(String args ) int i1=1234, i2=456, i3=-987; _; MaxValue=max(i1, i2, i3); System.out.println(“三个数的最大值:“+MaxValue); public _max(int x, int y, int z) int t

2、emp1, max_value; temp1=xy?x:y; _; return max_value; (分数:30.00)_2.本程序的功能是读入运行程序时所传入的参数(一个或多个),并将参数依次显示出来,例如运行程序:java exam_5 par1 par2,则打印输出为:par1 par2。 public class exam_5 public static void main(String args) int i=0; while(_) System.out.print(_+“ “); _; System.out.println(); (分数:30.00)_3.本程序的功能是把一个字

3、符串作为参数传递给程序,并与程序中的字符串比较,如果相等则输出“Equal”,否则输出“Unequal”,例如运行程序:java exam_6 Welcome,则打印输出:Equal。 public class exam_6 public static void main(String args) String str=_(“Welcome“); String temp=null; if(args.length0) _; if(_) System.out.println(“Equal“); else System.out.println(“Unequal“); System.out.print

4、ln(); (分数:40.00)_计算机二级 JAVA-46答案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1.本程序计算三个数(1234、456、-987)中的最大数并输出结果。 public class exam_4 public static void main(String args ) int i1=1234, i2=456, i3=-987; _; MaxValue=max(i1, i2, i3); System.out.println(“三个数的最大值:“+MaxValue); public _max(int x, int

5、 y, int z) int temp1, max_value; temp1=xy?x:y; _; return max_value; (分数:30.00)_正确答案:(int MaxValue static int max_value=temp1z?temp1:z (或 max_value=ztemp1?temp1:z)解析:2.本程序的功能是读入运行程序时所传入的参数(一个或多个),并将参数依次显示出来,例如运行程序:java exam_5 par1 par2,则打印输出为:par1 par2。 public class exam_5 public static void main(Str

6、ing args) int i=0; while(_) System.out.print(_+“ “); _; System.out.println(); (分数:30.00)_正确答案:(iargs.length args i i+(或 i=i+1或 i+=1)解析:3.本程序的功能是把一个字符串作为参数传递给程序,并与程序中的字符串比较,如果相等则输出“Equal”,否则输出“Unequal”,例如运行程序:java exam_6 Welcome,则打印输出:Equal。 public class exam_6 public static void main(String args) String str=_(“Welcome“); String temp=null; if(args.length0) _; if(_) System.out.println(“Equal“); else System.out.println(“Unequal“); System.out.println(); (分数:40.00)_正确答案:(new String temp=args 0 str.equals(temp)解析:

展开阅读全文
相关资源
猜你喜欢
  • GOST R 54506-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for ignition in a confined space《取决于物理和化学性质的危险化学品分类 有限空间着火的试验方法》.pdf GOST R 54506-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for ignition in a confined space《取决于物理和化学性质的危险化学品分类 有限空间着火的试验方法》.pdf
  • GOST R 54507-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for spray aerosols to determine the distance at which ignition occ.pdf GOST R 54507-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for spray aerosols to determine the distance at which ignition occ.pdf
  • GOST R 54508-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for pyrophoric solids《取决于物理和化学性质的危险化学品分类 自燃固体的试验方法》.pdf GOST R 54508-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for pyrophoric solids《取决于物理和化学性质的危险化学品分类 自燃固体的试验方法》.pdf
  • GOST R 54509-2011 Classification of chemicals which hazard is caused by physical and chemical properties Test methods of chemicals which consists of organic matter (self-reactive c.pdf GOST R 54509-2011 Classification of chemicals which hazard is caused by physical and chemical properties Test methods of chemicals which consists of organic matter (self-reactive c.pdf
  • GOST R 54510-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for flammability of aerosol foam《取决于物理和化学性质的危险化学品分类 气溶胶泡沫可燃性的试验方法》.pdf GOST R 54510-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for flammability of aerosol foam《取决于物理和化学性质的危险化学品分类 气溶胶泡沫可燃性的试验方法》.pdf
  • GOST R 54511-2011 Classification of chemicals hazardous due to their physical and chemical properties Method of determining the corrosive properties of chemicals《取决于物理和化学性质的危险化学品分类.pdf GOST R 54511-2011 Classification of chemicals hazardous due to their physical and chemical properties Method of determining the corrosive properties of chemicals《取决于物理和化学性质的危险化学品分类.pdf
  • GOST R 54512-2011 Classification of chemicals hazardous due to their physical and chemical properties Determination of ability of chemicals to emit flammable gases in contact with .pdf GOST R 54512-2011 Classification of chemicals hazardous due to their physical and chemical properties Determination of ability of chemicals to emit flammable gases in contact with .pdf
  • GOST R 54513-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for pyrophoric liquids《取决于物理和化学性质的危险化学品分类 自燃液体的试验方法》.pdf GOST R 54513-2011 Classification of chemicals hazardous due to their physical and chemical properties Test method for pyrophoric liquids《取决于物理和化学性质的危险化学品分类 自燃液体的试验方法》.pdf
  • GOST R 54514-2011 Classification of chemicals hazardous due to their physical and chemical properties Method of determining of ability of chemicals to the oxidative self-heating《取决.pdf GOST R 54514-2011 Classification of chemicals hazardous due to their physical and chemical properties Method of determining of ability of chemicals to the oxidative self-heating《取决.pdf
  • 相关搜索

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

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