a[]={1,1,2,3,5,8,13,21,34};
建立鍊節串列,並列印之
herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
計算你的BMI
-
1. 利用遞迴input n算2^n 2. 用C算GCD(3333,456)
-
請用 C/C++/java寫一簡易程式
-
33, 45, 87, 99, 27 算平均
-
一、 試利用switch case由程式中直接輸入一個1~7 之間的整數day,代表星期一到星期日。若day 的值是1,則印出 "星期一",若day 的值是2,則印出 "星期二",若day 的值是7,則印出 "星期日",...
-
BMI (Body Mass Index)= 體重 (kg) / 身高 ^2(m 2 ) 在台灣,行政院衛生署乃根據其相關研究,於2002年4月公佈台灣成人肥胖標準: BMI<18.5 為過輕, 18.5≦BMI<24 為正常體重, 24≦BMI<27 為過重, BM...
-
需要練習的Java程式:
-
用 C/C++算上學期加權平均
64 則留言:
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
}
}
public class Ex10 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
//新增在開頭
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
}
}
hello
class Node{
int data;
Node next;
public Node(int data) {
this.data = data;
next=null;
}
}
public class a01 {
public static void main(String[] args) {
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0;i<f.length;i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node ctrl=first;
while (ctrl!=null) {
System.out.print(ctrl.data+"|");
ctrl=ctrl.next;
}
}
}
34|21|13|8|5|3|2|1|1|
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex01 {
public static void main(String[] args)
{
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
int i=0;
for(i=0;i
{
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null)
{
System.out.print("|"+current.data+"|");
current=current.next;
}
System.out.println();
}
}
package ex1;
class Node{
int data;
Node next;
public Node(int data){
this.data=data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0;i<f.length;i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
[34]
[21]
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class EX1
{
public static void main(String[] args)
{
System.out.println("[以下開始]");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
//新增在開頭
for(int i=0; i<f.length; i++)
{
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
//列印
Node current=first;
while (current!=null)
{
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
[以下開始]
[34][21][13][8][5][3][2][1][1]
class Nobe{
int data;
Nobe next;
public Nobe(int data){
this.data=data;
next=null;
}
}
public class P1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Nobe first=null;
Nobe newNobe;
for (int i=0;i<f.length;i++){
newNobe=new Nobe(f[i]);
newNobe.next=first;
first=newNobe;
}
Nobe current=first;
while (current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[34]
[21]
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[34]
[21]
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[34][21][13][8][5][3][2][1][1]
package ex1;
class Node{
int data;
Node next;
public Node(int data){
this.data=data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0;i<f.length;i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
[34]
[21]
[13]
[8]
[5]
[3]
[2]
[1]
[1]
package ex1;
class Node{
int data;
Node next;
public Node(int data){
this.data=data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0;i<f.length;i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
[34]
[21]
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
}
}
public class Ex10 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
//新增在開頭
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
//列印
Node current=first;
while (current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[34]
[21]
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[34]
[21]
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args)
{
System.out.println("Hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0 ; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args)
{
System.out.println("Hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0 ; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args)
{
System.out.println("Hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0 ; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args)
{
System.out.println("Hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0 ; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node
{
int data;
Node next;
public Node(int data)
{
this.data=data;
next=null;
}
}
public class ex1
{
public static void main(String[] args)
{
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++)
{
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null)
{
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args)
{
System.out.println("Hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0 ; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data=data;
next=null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for (int i=0;i<f.length;i++){
newNode=new Node(f[2*i%7]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex01
{
public static void main(String[] args)
{
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for(int i=0; i<f.length ; i++)
{
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null)
{
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
結果:hello
[8][5][3][2][1][1]
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data) {
this.data = data;
next = null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[] = {1,1,2,3,5,8,13,21,34};
Node first = null;
Node newNode;
for(int i=0; i<f.length; i++)
{
newNode = new Node(f[i]);
newNode.next = first;
first = newNode;
}
Node current=first;
while (current != null)
{
System.out.print("["+current.data+"]");
current = current.next;
}
System.out.println();
}
}
hello
[34][21][13][8][5][3][2][1][1]
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex01
{
public static void main(String[] args)
{
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for(int i=0; i<f.length ; i++)
{
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null)
{
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
結果:hello
[8][5][3][2][1][1]
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data=data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13][8][5][3][2][1][1]
class Node{
int data;
Node next;
public Node(int data){
this.data=data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13][8][5][3][2][1][1]
class Node{
int date;
Node next;
public Node(int date) {
this.date = date;
next=null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.date+"]");
current=current.next;
}
System.out.println();
}
}
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int date;
Node next;
public Node(int date) {
this.date = date;
next=null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.date+"]");
current=current.next;
}
System.out.println();
}
}
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int date;
Node next;
public Node(int date) {
this.date = date;
next=null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.date+"]");
current=current.next;
}
System.out.println();
}
}
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data) {
this.data = data;
next = null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[] = {1,1,2,3,5,8,13,21,34};
Node first = null;
Node newNode;
for(int i=0; i<f.length; i++)
{
newNode = new Node(f[i]);
newNode.next = first;
first = newNode;
}
Node current=first;
while (current != null)
{
System.out.print("["+current.data+"]");
current = current.next;
}
System.out.println();
}
}
hello
[21]
[13]
[8]
[5]
[3]
[2]
[1]
[1]
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data) {
this.data = data;
next = null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[] = {1,1,2,3,5,8,13,21,34};
Node first = null;
Node newNode;
for(int i=0; i<f.length; i++)
{
newNode = new Node(f[i]);
newNode.next = first;
first = newNode;
}
Node current=first;
while (current != null)
{
System.out.print("["+current.data+"]");
current = current.next;
}
System.out.println();
}
}
hello
[34]
[21]
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int data;
Node next;
public Node(int data) {
this.data = data;
next=null;
}
}
public class ex10 {
public static void main(String[] args) {
int a[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<a.length; i++){
newNode=new Node(a[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
}
}
public class Ex10 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
//新增在開頭
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
}
}
hello
class Node{
int data;
Node next;
public Node(int data) {
this.data = data;
next = null;
}
}
public class h1 {
public static void main(String[] args) {
System.out.println("hello");
int f[] = {1,1,2,3,5,8,13,21,34};
Node first = null;
Node newNode;
for(int i=0; i<f.length; i++)
{
newNode = new Node(f[i]);
newNode.next = first;
first = newNode;
}
Node current=first;
while (current != null)
{
System.out.print("["+current.data+"]");
current = current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class EX1
{
public static void main(String[] args)
{
System.out.println("[以下開始]");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
//新增在開頭
for(int i=0; i<f.length; i++)
{
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
//列印
Node current=first;
while (current!=null)
{
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args)
{
System.out.println("Hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0 ; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node
{
int data;
Node next;
public Node(int data)
{
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args)
{
System.out.println("Hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0 ; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int date;
Node next;
public Node(int date) {
this.date = date;
next=null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.date+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13]
[8]
[5]
[3]
[2]
[1]
[1]
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
package p1;
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class hw1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
for (int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int date;
Node next;
public Node(int date) {
this.date = date;
next=null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.date+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
}
}
public class Ex10 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8};
Node first=null;
Node newNode;
//新增在開頭
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
}
}
class Node{
int date;
Node next;
public Node(int date) {
this.date = date;
next=null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.date+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int date;
Node next;
public Node(int date) {
this.date = date;
next=null;
}
}
public class ex01 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13,21,34};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while (current!=null){
System.out.print("["+current.date+"]");
current=current.next;
}
System.out.println();
}
}
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13]
[8]
[5]
[3]
[2]
[1]
[1]
class Node{
int data;
Node next;
public Node(int data){
this.data = data;
next=null;
}
}
public class ex1 {
public static void main(String[] args) {
System.out.println("hello");
int f[]={1,1,2,3,5,8,13};
Node first=null;
Node newNode;
for(int i=0; i<f.length; i++){
newNode=new Node(f[i]);
newNode.next=first;
first=newNode;
}
Node current=first;
while(current!=null){
System.out.println("["+current.data+"]");
current=current.next;
}
System.out.println();
}
}
hello
[13]
[8]
[5]
[3]
[2]
[1]
[1]
張貼留言