为什么我的方法没有返回任何东西?
class Test{
static int count = 0;
public static void main(String args[]){
String s = "------+ # ----+------";
countDoors(s);
}
public static int countDoors(String s){
char sigN= '+';
for(int i=0;i<s.length();i++)
if(s.charAt(i)==sigN)
count++;
return count;
}
}
Run Code Online (Sandbox Code Playgroud)
我肯定有点菜鸟的问题,但我真的想明白为什么它不起作用