I am new to the concepts of oop and therefore what I write have may have bad assumptions. Please correct me where appropriate.
In some code I saw a function takes in an argument in the form of int number
. Then, in the function the following line is written outputString = Integer.toString( number );
I interpreted this as go the the class Integer, find a method called toString() and feed this the int called number and set the output of that to outputString. Since the syntax is class.method(arg) I assumed that toString() is a static function.
I wanted to test if it was static. I rewrote the code with the argument as Integer number
and then did outputString = number.toString();
and it worked. This has the form obj.method(arg) which I had assumed would only work for non static methods.
I am unsure what conclusion to draw from this or if I have made a wrong assumption. Thanks.