Reputation: 51
I'm trying to assign the return of a method to an int, but it's giving me an error "cannot find symbol symbol : variable columnResult"
Here is the code:
public void start() {
String inputString = "XOXOXOO X XXO X OXO ";
columnResult();
int column = columnResult;
enterToken("X", inputString,column);
}
private int columnResult(){
System.out.println("Enter column for X:");
String keyInput = Keyboard.readInput();
int column1 = Integer.parseInt(keyInput);
return column1;
}
How can I fix it?
Upvotes: 1
Views: 116
Reputation: 5516
Change to -
int column = columnResult();
By just calling columnResult();
and not assigning the returned value you are loosing it.
Upvotes: 0
Reputation: 308
you should directly write
int column = columnResult();
Since it is a method which returns an int
Upvotes: 2
Reputation: 9100
columnResult();
int column = columnResult;
should be
int column = columnResult();
Upvotes: 0
Reputation: 276
Try
int column = columnResult();
instead of columnResult(); int column = columnResult;
You must assign the result of the function right to the integer.
Upvotes: 2
Reputation: 3204
You should be doing
int column = columnResult();
not
int column = columnResult;
Upvotes: 0