This error occurs because your toBinary method returns an integer but you didn’t put the declaration before the function name. It should be:
Public static int toBinary
However, you shouldn’t return your num variable, but binary variable.
So the method should be: public static String toBinary
Ok sorry I just saw that you had edited it. Alright I have done that but, String binary has already been defined in the method, that's the error message I am receiving now when I declare the String binary in the bracket as in toBinary(String binary)
I should have maintained the int num in as in toBinary(int num).
So when I got that error message: String binary has already been defined
- I realized that, that I was doing the wrong thing by trying to pass the String binary as an argument. The goal is to pass the integer num instead