Results 1 to 5 of 5
- 02-12-2010, 05:11 AM #1
Member
- Join Date
- Feb 2010
- Posts
- 9
- Rep Power
- 0
- 02-12-2010, 06:00 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,548
- Rep Power
- 11
Also posted here.
A string array instance is an object. So you would convert it by doing nothing.
The code you posted shows you attempting to create a string from an array of strings. What exactly are you trying to do? Concatenate the string elements? Create a "toString()" form for the array? Something else?
- 02-12-2010, 09:26 AM #3
Member
- Join Date
- Feb 2010
- Posts
- 9
- Rep Power
- 0
Solution
String arr[]={"s","y"};
// converting array of string into str object....
String str=new String(arr.toString());
- 02-12-2010, 10:50 AM #4
I think u are having character array ..not string I think....
Is this you want.
class Test
{
public static void main(String args[])
{
char c [] ={'r','a','m'};
System.out.println(new String(c));
}//main
}//classRamya:cool:
- 02-12-2010, 12:33 PM #5
Member
- Join Date
- Feb 2010
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
How to convert the Vector object into an array?
By tyang in forum New To JavaReplies: 4Last Post: 02-08-2010, 08:00 AM -
Convert Char Array to String Array
By Mayur in forum New To JavaReplies: 8Last Post: 10-12-2009, 11:41 AM -
convert a string to an object in java
By jforce93 in forum Advanced JavaReplies: 1Last Post: 08-09-2009, 11:57 PM -
Convert Comparable object to string or char
By ScKaSx in forum New To JavaReplies: 4Last Post: 01-25-2009, 02:02 PM -
Convert Linked List Object element to String
By CirKuT in forum New To JavaReplies: 2Last Post: 12-13-2008, 05:22 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks