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
Can we have static methods in an interface?
What is append in java?
What is deserialization?
How would you convert bytes to string?
What is the difference between actual and formal parameters?
why using interface interface ?
When can we say that threads are not lightweight process in java?
Why java is a platform independent? Explain
What is classes in java?
How to use Media tracker Class.
Why lambda expression is used in java?
What is an exception? difference between Checked and Unchecked exception in Java
How to display all the prime numbers between 1 and n (n is the number, get the input from user)
How to implement an arraylist in java?
What is the function of character?