Daniel, see how you called this method?:
input = console.nextDouble();
As you can see, you didn't need to declare or define the method .nextDouble(). Because some nerds have already written the details of this method in a class called console. Your code imported this class.
But maybe you have a different idea for getting the next double, so you define your own method, like this:
now, you want to use your method. But how would you tell the system which method you want to use? The one you made?(Which belongs to the decimalRound class) Or the one you imported?(Which belongs to the console class)
Here is the rule, if the method belongs to an external class, then you would:
-call the method directly off the class, because the method is static.Like the case of
-if the method was not defined as static, you would create an object and call the method off the object.(The method has to be defined as public so that you can use it) ex:
If the method belongs to the class you made, in this case, roundDecimal, you would just call it anywhere in your code. No dot operators or anything:
Now look at this line in your code:
the method round is not defined in your class, so that means that you either define it, or just import an external class that was written by some nerds which would contain the implementation of the round method.
That class exists, and is called Math, so
let me ask you a question, can you fill in these spaces?: