how to get the command line arguments from another class with java

后端 未结 5 787
栀梦
栀梦 2020-12-18 22:18

so suppose I have a java package....

it\'s got the main class with the main method

and then it\'s got a whole bunch of other classes.....

my question

5条回答
  •  爱一瞬间的悲伤
    2020-12-18 22:51

    As paxdiablo said, your main class would have to store these parameters and then either distribute or make available to needed ones. Often a good idea would be to let another class do the parsing of these parameters, and provide an object of this class instead of the raw command line to whoever needs it.

提交回复
热议问题