-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNode.java
More file actions
46 lines (36 loc) · 745 Bytes
/
Node.java
File metadata and controls
46 lines (36 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package sjsu.nguyen.cs146.project1;
public class Node {
private int data;
private Node link;
// Empty Constructor
public Node() {
this.data = 0;
this.link = null;
}
// One Parameter Constructor
public Node(int data) {
this.data = data;
this.link = null;
}
// Main Constructor
public Node(int data, Node link) {
this.data = data;
this.link = link;
}
// Returns the next Node
public Node getNext() {
return link;
}
// Alters the next Node
public void setNext(Node link) {
this.link = link;
}
// Return value of the Node
public int getData() {
return data;
}
// Alters the data
public void setData(int data) {
this.data = data;
}
}