java '*'的问题


public class hello
{
 public static void main(String[] args)
 {
  int a = Integer.parseInt(args[0]);
  char b = args[1].charAt(0);
  int c = Integer.parseInt(args[2]);
  switch(b)
  {
  case '+':System.out.print(a+" "+b+" "+c+" "+"= "+(a+c));
  break;
  case '-':System.out.print(a+" "+b+" "+c+" "+"= "+(a-c));
  break;
  case '*':System.out.print(a+" "+b+" "+c+" "+"= "+(a*c));
  break;
  case '/':System.out.print(a+" "+b+" "+c+" "+"= "+(a/c));
  break;
  default:break;
  }
 }
}
程序编译后
输入 +  -  /  运算后都没问题
关键是 * 的运算
有提示报错 
Exception in thread "main" java.lang.NumberFormatException: For input string: ".project"
 at java.lang.NumberFormatException.forInputString(Unknown Source)
 at java.lang.Integer.parseInt(Unknown Source)
 at java.lang.Integer.parseInt(Unknown Source)
 at hello.main(hello.java:8)
??????????
不明白~~~~

你可能感兴趣的:(java,String,职场,休闲)