Why am I getting null pointer exception at line 10 ?
I am running this program on command line as "java ComparingTwoNumbers 3,5"
I have also tried "java ComparingTwoNumbers one , three", but same NullPointerException
You need to convert the command line argument ie string into int using Integer wrapper class. And that can be done by
Determines the integer value of the system property with the specified name.
The first argument is treated as the name of a system property
and If there is no property with the specified name(ie parameter passed), if the specified name is empty or null, or if the property does not have the correct numeric format, then null is returned.