Hi, I came across the following question in my revision -
What will be printed by the above code if it is run with command line: java TestClass --0.50 (There are two minuses before 0.)
The explanation says
str.substring(1, str.length()-1) => "--0.50".substring(1, (6-1) ) => -0.5
which still seems too brief for me.
Could somebody explain how I tgets to -0.5?
I see this then gets rounded down to 0 and case 0 & case 1 are applied.