Parameters of Main, Sum - Practice Exercises Java Lesson 5: Functions Exercise 5.16: Parameters of Main, Sum Objetive: Create a program named "sum", which receives two integer numbers in the command line and displays their sum, as in this example: sum 5 3 8 Source Code: JAVA C# public class Main { public static void main(String[] args) { if (args.length == 2) { System.out.println(Integer.parseInt(args[0]) + Integer.parseInt(args[1])); } else { System.out.println("Two numbers, please"); } } } Copy Exercise to ClipBoard Copy Code to ClipBoard Exercisey 5.16
More exercises for Lesson 5 Previous Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 Next >>