package com.test.count; /** * * @author Kiran * */ public class LinkedList { Node headNode ; /** * This method appends the Node at the end of the List * * @param data */ public void appendNode( int data ) { Node currentNode = headNode ; if ( currentNode == null ) { Node newNode = new Node( data ); headNode = newNode ; return ; } while ( currentNode .getNextNode()!= null ) { currentNode = currentNode .getNextNode(); } currentNode .setNextNode( new Node( data )); } /** * This method prints all the Nodes/Values of the * LinkedList * */ public void printNodes() { Node currentNode = headNode ; if ( currentNode == null ) { System. out .println( " The Node is Null" ); return ; } else { System. out .print( " " + currentNode .getData()); while ( currentNo...
Blog about Programming.