This content has been marked as final. Show 6 replies
and then i saw you do this
t[index] = new String(first);
t is an int array, so you are trying to assign a string to an int, which also wont work.
Edited by: mkoryak on Nov 16, 2007 2:33 PM
also you say this:
num = new int;
this initializes an int array of 5 and then throws it away as soon as the constructor main method returns. i dont think you want that. you should the declairation up top where the int token is.
ok, so you dont have a constructor for the ticket class that matches the one you are trying to use.
i think you may need to go back to the examples, you have more problems in this code then there is lines of code.
Edited by: mkoryak on Nov 16, 2007 2:34 PM
thats because your ticket class doesnt have the constructor you are trying to call..
please give the actual error message not your paraphrasing of it
Edited by: mkoryak on Nov 16, 2007 2:40 PM
also, you shouldnt put int s into the constructor call.
like i said, you are averaging 2 errors per line of code, this is not a good thing.
Storm wrote:Well, that last line isn't valid syntax. You don't need to declare the parameter types of a constructor when you're invoking it.
I've try this... and it gives a compilation error. ".class expected"
int s= new s; Ticket a = new Ticket(int s, num);
The first line isn't valid either.
int s = new int;
Ticket a = new Ticket(s, num);
would be valid syntax (assuming some other things, such as both s and num are in scope, and that you have a Ticket constructor written to accept those parameters (which you don't, as already mentioned).
You're really hurting. Please go back to class and/or do the java tutorials.