Results 1 to 6 of 6
Thread: Sort String
- 10-06-2009, 04:19 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 71
- Rep Power
- 0
Sort String
why the output of this program is character:
import java.util.*;
public class array {
public static void main(String[] args) {
String[] strArray = new String[] {"z", "a", "C"};
Arrays.sort(strArray, String.CASE_INSENSITIVE_ORDER);
System.out.println(strArray);
}
}
output is:[Ljava.lang.String;@1a46e30:confused::cool:
-
You're getting the toString() representation of an array. to display an array, either loop through it with System.out.println calls within the loop, or use
Java Code:System.out.println(java.util.Arrays.toString(strArray));
- 10-08-2009, 01:35 PM #3
Member
- Join Date
- Nov 2008
- Posts
- 71
- Rep Power
- 0
ok sir. got it. thank you so much.
but is it natural that the output will have this symbols [string here]?
example. output: [kier,kyle] instead of kier,kyle.:cool:
- 10-08-2009, 01:46 PM #4
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
How about using a loop to iterate through the array while printing.
- 10-09-2009, 05:33 AM #5
Member
- Join Date
- Nov 2008
- Posts
- 71
- Rep Power
- 0
hi, can you help how? @dswastik:)
:cool:
- 10-09-2009, 08:08 AM #6
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
Similar Threads
-
Using Merge Sort to sort an ArrayList of Strings
By coldfire in forum New To JavaReplies: 3Last Post: 03-13-2009, 01:03 AM -
How to change Bubble+Selection+Insertion Sorts to Sort String Values?
By VinceGuad in forum New To JavaReplies: 3Last Post: 01-26-2009, 12:20 AM -
How to sort a list using Bubble sort algorithm
By Java Tip in forum AlgorithmsReplies: 3Last Post: 04-29-2008, 08:04 PM -
sort
By Camden in forum New To JavaReplies: 7Last Post: 11-28-2007, 01:11 AM -
how to sort
By Feng in forum New To JavaReplies: 1Last Post: 11-20-2007, 06:56 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks