【计算机类职业资格】计算机二级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)解析:

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 60843-3-1994 Helical-scan video tape cassette system using 8 mm magnetic tape-8 mm Video part 3 high-band specifications for Hi 8 (IEC 60843-3 1993) German version EN 60843-.pdf DIN EN 60843-3-1994 Helical-scan video tape cassette system using 8 mm magnetic tape-8 mm Video part 3 high-band specifications for Hi 8 (IEC 60843-3 1993) German version EN 60843-.pdf
  • DIN EN 60843-4-2000 Helical-scan video tape cassette system using 8 mm magnetic tape (8 mm video) - Part 4 Video subcode (VSC) (IEC 60843-4 2000) German version EN 60843-4 2000《使用8.pdf DIN EN 60843-4-2000 Helical-scan video tape cassette system using 8 mm magnetic tape (8 mm video) - Part 4 Video subcode (VSC) (IEC 60843-4 2000) German version EN 60843-4 2000《使用8.pdf
  • DIN EN 60848-2014 GRAFCET specification language for sequential function charts (IEC 60848 2013) German version EN 60848 2013《GRAFCET 顺序功能图表的规范语言 (IEC 60848-2013) 德文版本 EN 60848 201.pdf DIN EN 60848-2014 GRAFCET specification language for sequential function charts (IEC 60848 2013) German version EN 60848 2013《GRAFCET 顺序功能图表的规范语言 (IEC 60848-2013) 德文版本 EN 60848 201.pdf
  • DIN EN 60851-1-2010 Winding wires - Test methods - Part 1 General (IEC 60851-1 1996 + A1 2003 + A2 2009) German version EN 60851-1 1996 + A1 2004 + A2 2009《绕组线 试验方法 第1部分 总则(IEC 608.pdf DIN EN 60851-1-2010 Winding wires - Test methods - Part 1 General (IEC 60851-1 1996 + A1 2003 + A2 2009) German version EN 60851-1 1996 + A1 2004 + A2 2009《绕组线 试验方法 第1部分 总则(IEC 608.pdf
  • DIN EN 60851-2-2016 Winding wires - Test methods - Part 2 Determination of dimensions (IEC 60851-2 2009 + A1 2015) German version EN 60851-2 2009 + A1 2015《绕组线 试验方法 第2部分 尺寸测量(IEC 6.pdf DIN EN 60851-2-2016 Winding wires - Test methods - Part 2 Determination of dimensions (IEC 60851-2 2009 + A1 2015) German version EN 60851-2 2009 + A1 2015《绕组线 试验方法 第2部分 尺寸测量(IEC 6.pdf
  • DIN EN 60851-3-2014 Winding wires - Test methods - Part 3 Mechanical properties (IEC 60851-3 2009 + A1 2013) German version EN 60851-3 2009 + A1 2013《绕组线的测试方法 第3部分 机械性能》.pdf DIN EN 60851-3-2014 Winding wires - Test methods - Part 3 Mechanical properties (IEC 60851-3 2009 + A1 2013) German version EN 60851-3 2009 + A1 2013《绕组线的测试方法 第3部分 机械性能》.pdf
  • DIN EN 60851-4-2017 Winding wires - Test methods - Part 4 Chemical properties (IEC 60851-4 2016) German version EN 60851-4 2016《绕组线 试验方法 第4部分 化学性能(IEC 60851-4-2016) 德文版本EN 60851-4-.pdf DIN EN 60851-4-2017 Winding wires - Test methods - Part 4 Chemical properties (IEC 60851-4 2016) German version EN 60851-4 2016《绕组线 试验方法 第4部分 化学性能(IEC 60851-4-2016) 德文版本EN 60851-4-.pdf
  • DIN EN 60851-5-2012 Winding wires - Test methods - Part 5 Electrical properties (IEC 60851-5 2008 + A1 2011) German version EN 60851-5 2008 + A1 2011《绕组线 试验方法 第5部分 电气性能》.pdf DIN EN 60851-5-2012 Winding wires - Test methods - Part 5 Electrical properties (IEC 60851-5 2008 + A1 2011) German version EN 60851-5 2008 + A1 2011《绕组线 试验方法 第5部分 电气性能》.pdf
  • DIN EN 60851-6-2013 Winding wires - Test methods - Part 6 Thermal properties (IEC 60851-6 2012) German version EN 60851-6 2012《绕组线 试验方法 第6部分 热性能(IEC 60851-6-2012) 德文版本EN 60851-6-20.pdf DIN EN 60851-6-2013 Winding wires - Test methods - Part 6 Thermal properties (IEC 60851-6 2012) German version EN 60851-6 2012《绕组线 试验方法 第6部分 热性能(IEC 60851-6-2012) 德文版本EN 60851-6-20.pdf
  • 相关搜索

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

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