Created
January 29, 2013 13:34
-
-
Save fforbeck/4664278 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
try { | |
CsvReader products = new CsvReader("products.csv"); | |
products.readHeaders(); | |
while (products.readRecord()) | |
{ | |
String productID = products.get("ProductID"); | |
String productName = products.get("ProductName"); | |
String supplierID = products.get("SupplierID"); | |
String categoryID = products.get("CategoryID"); | |
String quantityPerUnit = products.get("QuantityPerUnit"); | |
String unitPrice = products.get("UnitPrice"); | |
String unitsInStock = products.get("UnitsInStock"); | |
String unitsOnOrder = products.get("UnitsOnOrder"); | |
String reorderLevel = products.get("ReorderLevel"); | |
String discontinued = products.get("Discontinued"); | |
// perform program logic here | |
System.out.println(productID + ":" + productName); | |
} | |
products.close(); | |
} catch (FileNotFoundException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment