command line arguments java * is being overloaded to pick up filenames

前端 未结 2 1594
借酒劲吻你
借酒劲吻你 2021-01-19 12:08

I am writing the most simple calculator in java that picks up command line arguments.Everything works fine, except the multiplication function. For some reason it picks up n

2条回答
  •  佛祖请我去吃肉
    2021-01-19 12:36

    Enclose the entire calculation string in quotes, and split it yourself:

    java Calculate "2 * 3"
    

    That only uses a * for multiplication.

提交回复
热议问题