Can't Pass An Argument To An Object's Method
in
Programming Questions
•
9 months ago
Why can't I pass an argument to the Method of an Object? I get an "unexpected token" error on the last line. Here's some stripped down code to demonstrate.
- class Obj {
- float vari;
- Obj( float tempV ) {
- vari = tempV;
- }
- void setVari( float tempV ) {
- vari = tempV;
- }
- }
- Obj Thing = new Obj( 15.0 );
- Thing.setVari( 30.0 );
1