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 purpose of assert keyword used in jdk1.4.x?
What is a memory leak in java?
What is the purpose of checked and unchecked exceptions in JAVA?
Discuss different types of errors that generally occur while programming.
Is java good for beginners?
How do you escape a string?
How do you calculate roots in java?
What is the use of isempty in java?
What is the difference between inheritance and encapsulation?
What is int short for?
What is java beans?
What is the use of set in java?
What is data movement?
Mention some interfaces implemented by linked list in java.
Explain aggregation in java?