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 a memory leak in java?
What is http client in java?
What is abstraction in java?
Can arraylist hold different types java?
What if static is removed from main method?
What is a cup of java?
What are the various access specifiers for java classes?
What is the use of put method?
What is difference between java and java ee?
What is multithreading and its advantages?
Why there is no call by reference in java?
we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.
why java uses class level type casting ?
What is java util concurrentmodificationexception?
What is the importance of hashcode() and equals() methods?