This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
when i try to compile and run the above code from DOS based command prompt, it gives an output as follows-
100 - 100.000000
i understand anInt is printed as 100 as it is of type integer and its length is 3 (as minimum number of characters (i.e WIDTH ) must be 2 as per the format specifier %2d) but, why is aDouble printed as 100.000000. There must be just two zeroes to sum the the total no. of characters(i.e WIDTH) to 8 as Double is 64bits. So, the output should be 100.0000
And when i try to compile the same above code in Eclipse IDE its showing an error for the statement : System.console().format("%2d - %1f", anInt, aDouble);
The method format(String, Object) in the type Console is not applicable for the arguments (String, int, double)