0

I am wondering how you can customize the argument command line in java to omit calculations in IntelliJ community edition. The book I have used for instructions only applies to NetBeans, which I am unable to access as of now. The following code attempts to do this:

public class Calculator { public static void main(String[] args) { float sum = 0; for (int i = 0; i < args.length; i++) { sum = sum + Float.parseFloat(args[i]); } System.out.println("Those numbers add up to " + sum); } } 

It's expected I have direct access to configuring the main string argument, I can enter in 8 6 7 5 3 0 9.

The intended output after running this program would look something like this:

"Those numbers add up to 38.0"

[1]: http://workbench.cadenhead.org/book/java-7-24 hours/source/chapter18/Calculator.java

1 Answer 1

2

Use Run/Debug Configurations | Program arguments in Application Run/Debug Configuration: enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.