Results 1 to 6 of 6
Thread: MultiD arrays
- 05-16-2012, 01:51 PM #1
Member
- Join Date
- May 2012
- Posts
- 7
- Rep Power
- 0
MultiD arrays HELP!!
hi every body,
i just can't figure out the problem here, i ve tried the very same code with a simple array instead of multi and it works:
/** Multidimentional + copy
*/
class ArrayComplicatedSomeHow {
public static void main (String[] args){
//declaring the multi dim arrays
char [][] copyFrom ={ {'a', 'b', 'c', 'd', 'e' },
{'1', '2', '3', '4', '5' }
};
char [][] copyTo = new char[5][5];
System.arraycopy(copyFrom[0],0, copyTo[0], 0, copyFrom.length);
System.out.println(new String(copyTo));
}
}
c:\classes\tutorial\Lesson>javac ArrayComplicatedSomeHow.java
ArrayComplicatedSomeHow.java:12: error: no suitable constructor found for String
(char[][])
System.out.println(new String(copyTo));
^
constructor String.String(int,int,char[]) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(StringBuilder) is not applicable
(actual argument char[][] cannot be converted to StringBuilder by method i
nvocation conversion)
constructor String.String(StringBuffer) is not applicable
(actual argument char[][] cannot be converted to StringBuffer by method in
vocation conversion)
constructor String.String(byte[]) is not applicable
(actual argument char[][] cannot be converted to byte[] by method invocati
on conversion)
constructor String.String(byte[],int,int) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(byte[],Charset) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(byte[],String) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(byte[],int,int,Charset) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(byte[],int,int,String) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(byte[],int) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(byte[],int,int,int) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(int[],int,int) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(char[],int,int) is not applicable
(actual and formal argument lists differ in length)
constructor String.String(char[]) is not applicable
(actual argument char[][] cannot be converted to char[] by method invocati
on conversion)
constructor String.String(String) is not applicable
(actual argument char[][] cannot be converted to String by method invocati
on conversion)
constructor String.String() is not applicable
(actual and formal argument lists differ in length)
1 errorLast edited by kintaru; 05-16-2012 at 02:54 PM.
- 05-16-2012, 03:01 PM #2
Member
- Join Date
- May 2012
- Posts
- 7
- Rep Power
- 0
Re: MultiD arrays
I ve actually found the problem but i wonder how to output my content using String when i have a multidimensional array?
i tired the same technic with a simple array: System.out.println(new String(myArray)); and it worked
- 05-16-2012, 03:32 PM #3
Re: MultiD arrays
Depends on the number of dimensions. Nested loops always work.how to output my content using StringIf you don't understand my response, don't ignore it, ask a question.
- 05-16-2012, 03:50 PM #4
Re: MultiD arrays
You've already been told about the code tags. Now how about putting that knowledge to use?
compiling issues
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 05-16-2012, 07:53 PM #5
Member
- Join Date
- May 2012
- Posts
- 7
- Rep Power
- 0
Re: MultiD arrays
M sorry Darry ve forgot
- 05-16-2012, 08:23 PM #6
Member
- Join Date
- May 2012
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
Copying Single Arrays to 2-D Arrays
By jmscarlet9 in forum New To JavaReplies: 7Last Post: 04-02-2012, 11:17 PM -
Casting Enum Type arrays to object type arrays
By nmvictor in forum Advanced JavaReplies: 4Last Post: 02-17-2012, 12:49 PM -
arrays and multidimensional arrays
By belfast09 in forum New To JavaReplies: 5Last Post: 06-14-2011, 01:28 PM -
store array of arrays in array of arrays
By joost_m in forum New To JavaReplies: 4Last Post: 04-19-2010, 10:32 AM -
Arrays.sort... why sorting all arrays in class?
By innspiron in forum New To JavaReplies: 6Last Post: 03-23-2010, 01:40 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks