5/20 lab 3.4 4.1 4.3兩提
public class Fibonacci
{
private static int f0 = 1;
private static int f1= 1;
private static int third ;
public static int next()
{
third=f0+f1;
f0=f1;
f1=third ;
return third ;
}
}
public class Fibonaccimain
{
public static void main(String[] args)
{
for (int i=1 ;i<10 ;i++)
System.out.println(Fibonacci.next());
}
}
A:
C:\Borland\JBuilder2005\jdk1.4\bin\javaw -classpath "C:\Documents and Settings\CYEL\jbproject\59\classes;C:\Borland\JBuilder2005\jdk1.4\jre\lib\im\indicim.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\im\thaiim.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\ext\dnsns.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\ext\sunjce_provider.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\ext\ldapsec.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\ext\localedata.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\jsse.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\plugin.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\sunrsasign.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\charsets.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\rt.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\jce.jar;C:\Borland\JBuilder2005\jdk1.4\jre\javaws\javaws.jar;C:\Borland\JBuilder2005\jdk1.4\lib\tools.jar;C:\Borland\JBuilder2005\jdk1.4\lib\dt.jar;C:\Borland\JBuilder2005\jdk1.4\lib\htmlconverter.jar" Fibonaccimain
2
3
5
8
13
21
34
55
89
{
private static int f0 = 1;
private static int f1= 1;
private static int third ;
public static int next()
{
third=f0+f1;
f0=f1;
f1=third ;
return third ;
}
}
public class Fibonaccimain
{
public static void main(String[] args)
{
for (int i=1 ;i<10 ;i++)
System.out.println(Fibonacci.next());
}
}
A:
C:\Borland\JBuilder2005\jdk1.4\bin\javaw -classpath "C:\Documents and Settings\CYEL\jbproject\59\classes;C:\Borland\JBuilder2005\jdk1.4\jre\lib\im\indicim.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\im\thaiim.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\ext\dnsns.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\ext\sunjce_provider.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\ext\ldapsec.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\ext\localedata.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\jsse.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\plugin.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\sunrsasign.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\charsets.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\rt.jar;C:\Borland\JBuilder2005\jdk1.4\jre\lib\jce.jar;C:\Borland\JBuilder2005\jdk1.4\jre\javaws\javaws.jar;C:\Borland\JBuilder2005\jdk1.4\lib\tools.jar;C:\Borland\JBuilder2005\jdk1.4\lib\dt.jar;C:\Borland\JBuilder2005\jdk1.4\lib\htmlconverter.jar" Fibonaccimain
2
3
5
8
13
21
34
55
89
0 Comments:
Post a Comment
<< Home