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 importance of hashcode() and equals() methods?
What are instance variables?
What is the super void?
What is difference between throw and throws ?
What is the exact difference in between Unicast and Multicast object? Where will it be used?
What are the types of strings?
How can you make sure that your singleton class will always return single instance in multi-threaded environment?
What is the purpose of using the java bean?
Is there any way to skip finally block of exception even if some exception occurs in the exception block?
How to implement an arraylist in java?
Which method cannot be overridden in java?
Compare overloading and overriding?
Explain the transient field modifier?
Does garbage collection occur in permanent generation space in jvm?
Tell us something about set interface.