Calling myMethod: Store the Result

Report a typo

Consider the following Java code snippet:

class MyClass {
    public int myMethod(double num) {
        return (int) num * 2;
    }
}

public class Main {
    public static void main(String[] args) {
        MyClass myObject = new MyClass();
        double myDouble = 4.5;
        // Call myMethod here ...
    }
}

What would be the correct way to call the method myMethod and store its result in an integer variable?

Select one option from the list
___

Create a free account to access the full topic