Browsing 7239 questions and answers with Jon Skeet
If you're trusting anything from the user's computer, that's a bad start IMO. (What's to stop the user from manually modifying the data recorded?) Normally a server which you can trust would be involved. However, that's a different matter... more 3/28/2014 2:16:42 PM
The requirement is if I pass 10.00, output should be 10.00 Then you're using the wrong type. double has no notion of significant digits - there's no difference between 10, 10.0 and 10.00. You should try using BigDecimal... more 3/28/2014 11:39:48 AM
You're printing out br1.toString() - you're calling toString() on the BufferedReader itself. BufferedReader doesn't override toString(), so you're getting the implementation from Object, as documented: The toString method for class... more 3/28/2014 6:48:09 AM
On the last iteration, i will be equal to path.length() - 1. Therefore in this statement: String nPlus1 = path.substring(i+1, i+2); ... the first argument will be equal to path.length(), and the second argument will be equal to... more 3/27/2014 7:55:10 PM
Once you've grouped the cars by make and model, each element of the sequence is a group. You can get the key for the group with the Key property, so you can find the group's Make and Model, but Year makes no sense... there will be multiple... more 3/27/2014 5:49:14 PM
Joda-Time only stores date/time values down to the millisecond - just like java.util.Date and java.util.Calendar. So no, there's no way you can precisely represent 412340 microseconds within the second (which is what your text... more 3/27/2014 2:03:09 PM
The problem is that you're joining over two anonymous types, but those types aren't compatible - the property names are different. You've got to have a single key type, so both sides of the equals must be of the same type,... more 3/27/2014 1:32:41 PM
You're using -jar, which makes the -cp part irrelevant. From the documentation: When you use the -jar option, the specified JAR file is the source of all user classes, and other class path settings are ignored. Either add ClassPath... more 3/27/2014 1:25:46 PM
The Z in your format pattern is the problem. That represents an RFC 822 time zone, which can't just be Z. If your input will always be in UTC, you can use: // The Z is now quoted as a literal. SimpleDateFormat readDate = new... more 3/27/2014 1:02:34 PM
I would suggest using the Builder pattern: public final class Person { private final int salary; private final int age; private final double height; private final String name; public Person(int salary, int age, double... more 3/27/2014 12:07:43 PM