Java基础新大纲作业:编译问题分析与程序设计练习.pdfVIP

  • 0
  • 0
  • 约2.58千字
  • 约 2页
  • 2026-02-06 发布于北京
  • 举报

Java基础新大纲作业:编译问题分析与程序设计练习.pdf

C:编程题

1、for循环(打印出100以内,能被3整除的所有数)

2、将下面的数组元素反向打印

int[]arr={11,22,33,44,55};

打印的结果为:[55,44,33,22,11]

3、将下面的数组元素前后互换

[11,32,55,47,79,23]

置换后的数组元素为:

[23,79,47,55,32,11]

4、在数组中查询数据第一次55出现的位置,打印第一次出现的位置

[11,32,55,47,55,79,23]

5、编写方法,获取到数组中最大的元素,返回该元素的值

6、编写方法,判断指定的年份是平年还是闰年,返回对应的天数

D:分析画图推原理(要求画出内存图,并对结果进行解释)

1、画内存图,并写出程序运行的结果。

publicclassTest{

publicstaticvoidleftshift(inti,intj){

i+=j;

}

publicstaticvoidmain(Stringargs[]){

inti=4,j=2;

leftshift(i,j);

System.out.println(i);

}

}

2、画内存图,并写出程序运行的结果。

classTest{

publicstaticvoidmain(String[]args){

inta=10;

intb=20;

intsum=getSum(a,b);

System.out.println(sum=+sum);

}

publicstaticintgetSum(inta,intb){

intsum=a+b;

returnsum;

}

}

C:ProgrammingQuestions

1.forloop(printallnumbersdivisibleby3within100)2.

Reverseprinttheelementsofthefollowingarrayint[]arr=

{11,22,33,44,55};Theprintedresultis:[55,44,33,22,11]3.Swap

thefrontandbackelementsofthefollowingarray[11,32,55,

47,79,23]Theelementsafterswappingare:[23,79,47,55,32,11]

4.Inthearray,findthefirstoccurrenceof55andprintits

position[11,32,55,47,55,79,23]5.Writeamethodtogetthe

largestelementinthearrayandreturnitsvalue6.Writea

methodtodeterminewhetheraspecifiedyearisacommon

yearoraleapyear,andreturnthecorrespondingnumberof

days

D:AnalyzeDiagramstoDerivePrincip(Requiresdrawingmemorydiagrams

andexiningtheresults)

1.Drawthememorydiagramandwri

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档