How to use terminal arguments with values in Java?

前端 未结 4 1682
长发绾君心
长发绾君心 2021-01-25 06:36

For my school project I am creating a game like Bad Apples for iPhone (not my personal choice but it isn\'t the problem).

The game needs to have two versions, the first

4条回答
  •  孤街浪徒
    2021-01-25 07:15

    To answer the question you actually asked ...

    Some of the elements of your args array are of the form "--SOMETHING=ANOTHER".

    So, first thing you need is:

    if(args[x].startsWith("--SOMETHING")) { 
    

    The second problem is to parse off the ANOTHER.

    args[x].split("=") 
    

    is the place to start with that.

提交回复
热议问题