Re: WOW << newbie, q about methods of object

Your gonna have to give us a lot more detail.

Show us the code that is giving you grief and the error you are getting from it.

right, sorry, basically i want to know how i could make something like this work. It seems like it would work to me because toCharArray() is supposed to return a character array…

class Bwards
{

public static void main(String args[])
{
char ch[] = args.toCharArray();
}

}

sorry for the first foggy post.

There’s your problem.

args is an array, not a string. Arrays dont have a toCharArray function.

args[n] are your Strings.

You need to say something like:


args[0].toCharArray()

If you want to make one char array out of all your arguments youll need to do something like this:


String combined = "";
for(int i=0;i<args.length;i++){
 combined+=args[i];
}

Char[] carray = combined.toCharArray();

ok sorry, basically i want something like this to work.


class Bwards
{

   public static void main(String args[])
   {
         char ch[] = args.toCharArray();
   }

}

Well I want a million dollars, but it ain’t gonan happen.

And neither is that code going to work. Its wrong.

Edit: From chat what we figured out he wants is args[0].toCharArray()