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
What is the final field modifier?
How do you override a method in java?
Where are register variables stored?
What is string subsequence method?
What is parameters example?
Can inner class have constructor?
Why wait and notify methods are declared in object class?
Can we create object of static class?
What is a prefix function.write down a code to compute prefix function.
Is object a data type?
What is Hierarchy of exception?
What is stack example?
List the interfaces which extends collection interface?
What is an arraylist in java?
What are selection structures?