answersLogoWhite

0


Best Answer

string sorting means sorting the string array in a specific order

an example is given below

import java.io.*;

public class stringArray

{public static void main(String args[])throws IOException

{String A[]=new String[10];int i=0,j=0;String tmp;

InputStreamReader read=new InputStreamReader(System.in);

BufferedReader in=new BufferedReader(read);

System.out.println("enter the names");

for(i=0;i<10;i++)

A[i]=(in.readLine());

for(i=1;i<10;i++)

{

for(j=0;j<10-i;j++)

{

if(A[j].compareTo(A[j+1])>0)

{tmp=A[j];

A[j]=A[j+1];

A[j+1]=tmp;

}

}

}

System.out.println("the sorted array is ");

for(i=0;i<10;i++)

System.out.println(A[i]);

}

}

if the input is:

enter the names

kurian

avinash

thomson

satheesh

rahul

rohir

anand

basil

glen

james

the output will be :

the sorted array is

anand

avinash

basil

glen

james

kurian

rahul

rohir

satheesh

thomson

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is meant by string sorting in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a program sort a list of names in alphabetical order in java programming language?

// 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);


Where can one find advice about working with Java sorting arrays?

There are many places where one could find advice about working with Java sorting arrays. The best place to learn more about working with Java would be to contact Oracle.


What does it mean to have a string split in java?

To have a string split in Java means that a string array, containing substrings (can be delimited by elements of a specified string or Unicode character array), is returned.


Ascending order program for java?

public class BubbleSortAscendingOrderDemo { public static void main(String a[]) { //Numbers which need to be sorted int numbers[] = {23,5,23,1,7,12,3,34,0}; //Displaying the numbers before sorting System.out.print("Before sorting, numbers are "); for(int i = 0; i &lt; numbers.length; i++) { System.out.print(numbers[i]+" "); } System.out.println(); //Sorting in ascending order using bubble sort bubbleSortInAscendingOrder(numbers); //Displaying the numbers after sorting System.out.print("Before sorting, numbers are "); for(int i = 0; i &lt; numbers.length; i++) { System.out.print(numbers[i]+" "); } }


Concat a string without using any inbuilt function in java?

Use "+". Example: String string = "does this answer " + "your question?";

Related questions

Sorting an array of numbers in java?

here you will a good example on java sorting algorithm application http://javacodespot.blogspot.com/2010/08/java-sorting-animations.html http://javacodespot.blogspot.com/


Write a program sort a list of names in alphabetical order in java programming language?

// 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);


What are some example for string formatting in Java?

There are lots of examples of string formatting in Java. It can be difficult at times. Some of these examples are, but are not limited to; align, string, format, and JAVA.


Sorting of array through function in java programming?

// the build in sorting functions in Java will sort pretty much any array // of Comparable objects or primitives Arrays.sort(someArray);


Where can one find advice about working with Java sorting arrays?

There are many places where one could find advice about working with Java sorting arrays. The best place to learn more about working with Java would be to contact Oracle.


What does it mean to have a string split in java?

To have a string split in Java means that a string array, containing substrings (can be delimited by elements of a specified string or Unicode character array), is returned.


In computer terms what does the phrase 'java string replace' mean?

When referring to computer terms, the phrase "java string replace" means that a string in the line of code that Java uses, is being replaced, or needs to be replaced.


Ascending order program for java?

public class BubbleSortAscendingOrderDemo { public static void main(String a[]) { //Numbers which need to be sorted int numbers[] = {23,5,23,1,7,12,3,34,0}; //Displaying the numbers before sorting System.out.print("Before sorting, numbers are "); for(int i = 0; i &lt; numbers.length; i++) { System.out.print(numbers[i]+" "); } System.out.println(); //Sorting in ascending order using bubble sort bubbleSortInAscendingOrder(numbers); //Displaying the numbers after sorting System.out.print("Before sorting, numbers are "); for(int i = 0; i &lt; numbers.length; i++) { System.out.print(numbers[i]+" "); } }


How does the string trim work in Java?

The string trim works in Java by trimming white space from the beginning and end of a string. It cleans up the string and makes makes it neater for the users of the program.


What are the different between'a' and ''a in java string methods?

The difference between 'a' and "a" anywhere in Java is that 'a' is a primitive char type, while "a" is a String object.


Where could someone find an example of Java string comparisons?

There are many sites to find examples of Java string comparisons. Java Revisited, Java Coffee Break, Alvin Alexander, Stack Overflow and Lee Point are a few to start with.


Is String in java a class or object?

String is a pre-defined class in Java. For example: String s = new String("This is a string"); the variable s is now a String object since it was declared and initialized in the String class.