Monthly Archives: August 2013

Using try/catch

public class demo1 { public static void main(String cp[]) { int d,input; try { d=0; input=15/d; } catch(Exception e) { System.out.println(“EXception seen is “+e); } } } Advertisements

Posted in Uncategorized | Leave a comment

Demonstrate ArrayList

import java.util.*; class ArrayListDemo { public static void main(String args[]) { // Create an array list. ArrayList<String> al = new ArrayList<String>(); System.out.println(“Initial size of al: ” + al.size()); // Add elements to the array list. al.add(“C”); al.add(“A”); al.add(“E”); al.add(“B”); al.add(“D”); … Continue reading

Posted in Uncategorized | Leave a comment