Since the local variables are preferred over the class variables, the class variables are never set. Inside the
getdata method you are setting the local (method scoped) variables to their own value. Hence, in the displaydata method, you are printing the default values of the integers (0).
To fix this, you can either change the names of the variables, by prefixing them for example, or use
this to set the scope.
|


0 comments:
Post a Comment
Note: only a member of this blog may post a comment.