Quote:
The input from the console is stored in the "str" variable, so you need to pass that to the function.
Changing the line where the function is called to the following makes it work.
Code:
The problem is that the variable "power" does not exist in the main scope. It only exists in the function-scope.
The input from the console is stored in the "str" variable, so you need to pass that to the function.
Changing the line where the function is called to the following makes it work.
Code:
Code:
System.out.println("Conversion to decimal: " + binaryToDecimal(str));