帮忙做一下java作业

来源:百度知道 编辑:UC知道 时间:2024/05/30 02:19:36
急用
运行后,a[5]的内容为______ ,程序的输出(显示)结果为______。
public class test_1
{
public static void main(String[ ] args)
{
int x ;
int a[ ]={0,0,0,0,0,0};
calculate(a,a[5]);
System.out.println(“value is ”+a[0]);
}
static int calculate(int x[ ],y)
{
for(int i=1 ;i<6; i++)
if (y<6)
x[i]=x[i-1]+1;
return x[0];
}
}
以下程序的运行结果是 。
public class Test2
{ public static void main(String args[ ]){
int i , j=0 ;
int a[ ] = { 3,4,9,1,7,6};
for ( i = 1 ; i < a.length-1; i ++ )
if ( a[j]>a[i] )
j = i;
System.out.println(a[j]+" ");
}
}
以下程序的运行结果是 。
class First{
public First(){
aMethod(); }
public void aMethod(){
System.ou

1.
运行后,a[5]的内容为0,程序的输出(显示)结果为0
这个题通常会在面试中碰到,把a数组只是值传递过去再方法里再怎么修改
Main方法里还是原始的值
2.
输出结果为1;比较前5个数赵最下的Ok
3.
in First
in Test3
创建子类的时候最先执行的超类的构造方法

自己运行一下不就知道了?