Skip to content

Commit 0e5c95b

Browse files
committed
[hamill] feat : Main 클래스 생성, LinkedList 클래스 생성 후 inner 클래스로 Node 클래스 생성
1 parent 709a7fb commit 0e5c95b

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
package com.codesquad.datastructurestudy.linkedlist;
22

33
public class LinkedList {
4+
// 첫 번째 노드를 가리키는 필드
5+
private Node head;
6+
private Node tail;
7+
private int size = 0;
8+
9+
private class Node {
10+
// 데이터가 저장될 필드
11+
private Object data;
12+
// 다음 노드를 가리키는 필드
13+
private Node next;
14+
public Node(Object input) {
15+
this.data = input;
16+
this.next = null;
17+
}
18+
// 노드의 내용을 쉽게 출력해서 확인 해볼 수 있는 기능
19+
public String toString() {
20+
return String.valueOf(this.data);
21+
}
22+
}
23+
24+
425
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.codesquad.datastructurestudy.linkedlist;
2+
3+
public class Main {
4+
5+
public static void main(String[] args) {
6+
LinkedList numbers = new LinkedList();
7+
}
8+
}

0 commit comments

Comments
 (0)