Java arguments from text file
<p>I'm trying to pass arguments from a text file and perform the corresponding action on an object in java. I have the following thus far:</p>

<pre><code>    public static void main(String[] args) throws FileNotFoundException {
    Portfolio portfolio=new Portfolio();
    Scanner reader = new Scanner(new FileInputStream(args[0])).useDelimiter("\n");
            while(reader.hasNext()){
        String arg=reader.next();
        if(reader.hasNextInt()){
            int cash=reader.nextInt();
                      portfolio.arg(cash);
        }
        else if(reader.hasNext()){
            String ticker=reader.next();
            int shares=reader.nextInt();
            float price=reader.nextFloat();
              portfolio.arg(ticker,shares,price);
                    }
        portfolio.arg();
    }
    reader.close();


}
</code></pre>

<p>How can I pass the first as a method to the portfolio object, and the remaining as arguments for that method? Having a lot of trouble with this, thanks.</p>
