Kiratiphan 0 Newbie Poster

my project is sort score of Student
using Linked List and sort algorithm
can i coding loop for input from user
and save value to node in linked list
and export or sort value like this ?
Thanks for help or discuss or give any idea
(any code is idea from this blog)
warning before post prob from this web (Curly braces { } may only be used when posting code.)

package javaapplication19;
import static javaapplication19.LinkedList.addNode;
import static javaapplication19.LinkedList.printLinkedList;

public class JavaApplication19

        public static void main(String [] args) throws IOException {
    BufferedReader input = new BufferedReader(
            new InputStreamReader(;
    Node head = null;
    String name;
    double score;
            int counter=1;
    System.out.print("Insert number of student : ");
    int nStudent = Integer.valueOf(input.readLine());
    for(int i=0;i<nStudent;i++) {
                    System.out.println("Number "+counter+".");
        System.out.print("Student Score : "); 
        score = Double.parseDouble(input.readLine());
        head = addNode(head,score);




package javaapplication19;

public class LinkedList

public static Node addNode(Node head,double point) {
    Node newNode = new Node();
    newNode.point = point; = null;

    Node trav1, trav2;
    trav1 = trav2 = head;
    while(trav1 != null) {
        trav2 = trav1; 
        trav1 =;
    if(trav1 != trav2) = newNode;
    else head = newNode;

    return head;

public static void printLinkedList(Node head) {
    Node trav = head;
    int count=1;
    while(trav != null) {

        System.out.println("Score : "+trav.point);
        trav =;

private LinkedList() {


package javaapplication19;

import static java.util.Collections.sort;

public class Node

public double point;
public Node next;

public Node() {

    this.point = 0.0; = null;

public Node(double point, Node next) {
    this.point = point; = next;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.