Sunday, April 12, 2015

External JAR file in Eclipse with Javadocs

package practiceExternalJar;

import java.util.ArrayList;

import chapter07.InventoryItem;
import chapter07.Rectangle;

/**This project will help you learn how to use the external JAR file containing all the classes
* created in chapter 7.  This will also help you understand importing packages and troubleshooting
* your code with Eclipse.  Watch the accompanying video for step-by-step instructions:
* http://youtu.be/uNca-f2eP-Q
* You can run classes directly from jar files on the command line:
* i.e. java -cp jar_name.jar package.class  - java -cp Chapter07.jar varArgs.VarargsDemo4
*/


public class TestClass {

    @SuppressWarnings("unused")
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        InventoryItem item=new InventoryItem();
        Rectangle rAngle=new Rectangle();
       
        InventoryItem[] itemArray=new InventoryItem[4];
        ArrayList<InventoryItem> itemList=new ArrayList<InventoryItem>();
        itemArray[0]=new InventoryItem();
        itemArray[0].setUnits(5);
        itemArray[0].setDescription("Test object");
       
        itemList.add(itemArray[0]);
        System.out.println(itemList.get(0).getDescription());
        System.out.println(itemList.get(0).getUnits());
        System.out.println();
    }
}

No comments:

Post a Comment