I have the following code:
public class BinaryDecoder{
public static void main(String[] args){
String binNum = "110101";
int res = 0;
for (int i = 0;i<binNum.length();i++){
//res += parseDigit(binNum.charAt(i),binNum);
}
// System.out.println(res);
}
public static int parseDigit(int index, String binNum){
switch (binNum.charAt(index)){
case 0:
break;
case 1:
int val = (int) Math.pow(2,-index+binNum.length());
return val;
}
}
}
And I am getting the error: BinaryDecoder.java:30: error: missing return statement } ^
I may have interpreted this wrong, but why would my class BinaryDecode have or even need a return statement? Is there something else wrong with the code?
Note: I am fairly new in java, so sorry if there are any obvious errors in my code.
Aucun commentaire:
Enregistrer un commentaire