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 difference between array and array list in java?

796


What is a jagged array in java?

785


What is the function of http?

764


What is the difference between static (class) method and instance method?

794


What is an class?

768


When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?

814


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread

753


Difference between static synchronization vs. Instance synchronization?

821


Is a boolean variable?

737


What is an array in java?

866


What is unicode in java?

718


What is an escape character in java?

779


What is difference between iterator and enumeration in java?

744


What are the types of relation?

796


how to write a program for sending mails between client and server

1810