主题:[讨论]如何实现输出
class TimeFactor
{
public static void main(String[] args)
{
getTimeFactor(4);
}
private static int[] getTimeFactor(int d)
{
int[] fib = new int[d];
fib[1] = fib[2] = 1;
for(int i = 3; i < fib.length; i++)
fib[i] = (fib[i-1] + fib[i-2]);
for(int i = 1; i < fib.length; i++)
System.out.println("fib["+i+"]="+fib[i]);
System.out.println();
return fib;
}
}
public class ExpSimulation
{
public static void main(String args[])
{
System.out.println("HELLO");
}
}
在这段程序中,只能输出timefactor的值,无法输出HELLO,请问各位高手如何解决
{
public static void main(String[] args)
{
getTimeFactor(4);
}
private static int[] getTimeFactor(int d)
{
int[] fib = new int[d];
fib[1] = fib[2] = 1;
for(int i = 3; i < fib.length; i++)
fib[i] = (fib[i-1] + fib[i-2]);
for(int i = 1; i < fib.length; i++)
System.out.println("fib["+i+"]="+fib[i]);
System.out.println();
return fib;
}
}
public class ExpSimulation
{
public static void main(String args[])
{
System.out.println("HELLO");
}
}
在这段程序中,只能输出timefactor的值,无法输出HELLO,请问各位高手如何解决