Sunday, March 31, 2013

Collection to Array



package com.swain.cell;

import java.util.ArrayList;
import java.util.List;

public class CollectionToArray {

       public static void main(String[] args) {
              List list = new ArrayList();
              list.add("This ");
              list.add("is ");
              list.add("a ");
              list.add("good ");
              list.add("program.");
              Object[] s1 = list.toArray(new String[0]);
              for (int i = 0; i < s1.length; ++i) {
                     String contents = (String) s1[i];
                     System.out.print(contents);
              }
       }

}

How to Calculate the Future Investment Value of Investment.

Below java program for calculate future investment value. Here calculate s using the formula futureInvestmentValue =investmentAmount x (...