Monday, August 20, 2012

How to count duplicate characters from a sentence in java

Output :

package com.swain.cell;

import java.util.HashMap;

public class DuplicateCharacter {

        * @param args
       public static void main(String[] args) {
              // TODO Auto-generated method stub

        String str = "Character duplicate word example java";
        char ch1[]=str.toCharArray();
        HashMap<Character,Integer> hm=new HashMap<Character,Integer>();
        for(int i=0; i<ch1.length; i++)
            char ch=ch1[i];
        System.out.println("No of Characters are : "+hm.toString());


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 (...