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


Please Help Members By Posting Answers For Below Questions

What is the purpose of assert keyword used in jdk1.4.x?

555


What is ternary operator in java?

589


In how many ways we can create threads in java?

625


What is the difference between keyword and identifier?

525


What does it mean that a method or field is “static”?

544






What is nested top-level class?

573


If two threads have same priority which thread will be executed first ?

839


What happens when I use / and % with a negative numerator?

535


How many bits is a string in java?

568


Is vector ordered in java?

531


Can main() method in java can return any data?

636


Is int a class in java?

521


What is ph and buffers?

516


What is rule of accessibility in java?

537


What is the console in java?

672