Write a java program to get a string of words and print the numbers of each word count in descending order

Answer Posted / hema talele

package com;

public class StringChar {

/**
* @param Hema.talele
*/
public static void main(String[] args) {
String str = "HemaLovesMilind";

System.out.println(str);

for(int i= str.length(); i>0 ; i--)
{
System.out.println("char="+str.charAt(i-1));
System.out.println("index of
letter="+str.indexOf(str.charAt(i-1)));
System.out.println("simple count"+i);
System.out.println(str.charAt(i-1)+"="+i);
}

}

}

Is This Answer Correct ?    24 Yes 26 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we have static methods in an interface?

811


What is append in java?

875


What is deserialization?

816


How would you convert bytes to string?

772


What is the difference between actual and formal parameters?

723


why using interface interface ?

1785


When can we say that threads are not lightweight process in java?

851


Why java is a platform independent? Explain

774


What is classes in java?

720


How to use Media tracker Class.

877


Why lambda expression is used in java?

790


What is an exception? difference between Checked and Unchecked exception in Java

788


How to display all the prime numbers between 1 and n (n is the number, get the input from user)

755


How to implement an arraylist in java?

731


What is the function of character?

793