answersLogoWhite

0


Best Answer

// Let's assume we're sorting the characters in String toSort

// convert the String to an array of characters

char[] chars = toSort.toCharArray();

// let Java do the sorting for you

Arrays.sort(chars);

// recreate the original String with the newly sorted array of characters

toSort = new String(chars);

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

// returns a sorted copy of str

public static final String sortString(final String str) {

// convert str to a character array

char[] strChars = str.toCharArray();

// sort character array

Arrays.sort(strChars);

// convert strChars back to a string and return it

return new String(strChars);

}

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

For storing the data, I suggest an array, or an ArrayList. For the sorting, to keep it simple you might want to do a bubble sort.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program sort a list of names in alphabetical order in java programming language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the program that allows the user to write applications software?

programming language paradigm


Programming process of c language?

Write the source program. Compile. Link executable. Run it.


What are the individual instructions that you use to write a program in a high-level programming language called?

Statements.


A program written in a high-level programming language is called?

the program written in high level language is called "source program"


Can you write a program in DBMS like C?

DBMS means Data Base Management System, it is not a programming language.


How do you change source code into machine code?

A program called a compiler, or sometimes an assembler (depending on the programming language) does this for you. You write the source code, then invoke the program that will convert this into machine language.


What well known software program did Scott Meyers write?

Scott Meyers was not the creator of any programming language. He is a software consultant who specializes in C++ computer programming language, and has written many books on it.


How is java both a programming language and a platform?

By using Navite Interface we write this type of code


Which language is used to write a source program in computer?

There are so many programming languages that it is impossible to tell without actually seeing the source program in question.


How does pseudo code operate?

It doesn't. Pseudo code isn't a programming language, it is just there to give an idea of how you could write a program.


What programming language uses a set of grammar and rules that specifies how to write instructions?

Every programming language has rules that specify how to write instructions. Many programming languages are similar, but mostly they all have different styles and ways of writing the same instructions. This is called the syntax.


Which language do you use if you are creating an application to be deployed via a network?

Deployment methods are not integral to any programming language. You can use any suitable programming language to write the actual program, but how you deploy it is entirely up to you. However, there are installation tools that can assist with your deployment strategy.