Syntax Error: expecting rightparen before
I wrote a singleton class to keep track of some variables across my application.
I am getting a syntax error that I can't figure out, I am sure that I am missing something simple but it's been one of those days. Anyone see something wrong with my code?
The error is 1084: Syntax error: expecting rightparen before resultNumber.
public static function setResult(int resultNumber, int value): void
{
switc开发者_如何学JAVAh(resultNumber)
{
case 2: { this.result2 = value; break; }
case 3: { this.result3 = value; break; }
case 4: { this.result4 = value; break; }
case 5: { this.result5 = value; break; }
case 6: { this.result6 = value; break; }
case 7: { this.result7 = value; break; }
case 8: { this.result8 = value; break; }
case 9: { this.result9 = value; break; }
case 10: { this.result10 = value; break; }
case 11: { this.result11 = value; break; }
case 12: { this.result12 = value; break; }
case 13: { this.result13 = value; break; }
case 14: { this.result14 = value; break; }
}
}
This is not Java:
public static function setResult(resultNumber:int, value:int): void
{
switch(resultNumber)
{
case 2: { this.result2 = value; break; }
case 3: { this.result3 = value; break; }
case 4: { this.result4 = value; break; }
case 5: { this.result5 = value; break; }
case 6: { this.result6 = value; break; }
case 7: { this.result7 = value; break; }
case 8: { this.result8 = value; break; }
case 9: { this.result9 = value; break; }
case 10: { this.result10 = value; break; }
case 11: { this.result11 = value; break; }
case 12: { this.result12 = value; break; }
case 13: { this.result13 = value; break; }
case 14: { this.result14 = value; break; }
}
}
精彩评论