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 ternary operator in java?
In how many ways we can create threads in java?
What is the difference between keyword and identifier?
What does it mean that a method or field is “static”?
What is nested top-level class?
If two threads have same priority which thread will be executed first ?
What happens when I use / and % with a negative numerator?
How many bits is a string in java?
Is vector ordered in java?
Can main() method in java can return any data?
Is int a class in java?
What is ph and buffers?
What is rule of accessibility in java?
What is the console in java?