Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2.  * Exercise 2
  3.  * Define a class named as LinkedList with appropriate fields and constructors.
  4.  * Include a method called isEmpty() and write a Java application to test the method.
  5.  * @author MUHAMMAD AZRI BIN JASNI
  6.  * @version 10 OCTOBER 2012
  7.  */
  8. public class exercise2
  9. {
  10.     public static void main(String [] args)
  11.     {
  12.         System.out.println("This JavaApp will test method isEmpty.\nCreating a new linkedList.");
  13.         LinkedList list = new LinkedList();
  14.         //System.out.println("data:"+list.head.data);
  15.         //System.out.println("link:"+list.head.link);
  16.         System.out.print("Checking... ");
  17.         if (list.isEmpty())
  18.             System.out.println("List is empty.");
  19.     }
  20. }