Browsing 7239 questions and answers with Jon Skeet
You only need the extra class because you've got two pieces of information to maintain - and you've only got two pieces of information to maintain because you're ignoring the return value of the recursive call. I suspect that you could... more 9/29/2014 7:22:31 AM
There are two separate locks involved here - one for the instance on which you call update, and one for the class itself. So thread B would be blocked until thread A had completed, but the other two threads would execute without blocking.... more 9/29/2014 5:57:29 AM
But why is Super() printed, since Super::Super() hasn't never been called? It has, because your Sub constructor is implicitly calling it. It's as if you'd written: public Sub(int x, int y) { super(); ... more 9/28/2014 5:25:45 PM
Well yes, look at the signature of Long.toHexString: public static String toHexString(long i) You're trying to pass in a string. Given that it's meant to convert a long into a string, it's not at all clear what you would expect this to... more 9/28/2014 5:14:22 PM
To implement multiple ways of sorting a collection of Employee references, you should create separate classes implementing Comparator<Employee>. So you might have: public class EmployeeAgeComparator implements... more 9/28/2014 9:08:55 AM
You're currently not doing anything with your transfer_date variable at all. Your SQL statement contains the text transfer_date, but it doesn't automatically fetch the value from the database. You want something like: // @transfer_date is... more 9/28/2014 7:59:05 AM
You've misunderstood the parameters to Substring - they aren't start and end (as they are in Java), they're start and length. So you want: No = line.Substring(Start, End - Start); From the docs: Parameters startIndex Type:... more 9/28/2014 7:52:10 AM
You're clearly familiar with array initializers where you specify the content up-front... but you can also create arrays just by specifying the length, like this: String[] array = new String[length]; This will create an array where... more 9/27/2014 7:21:17 AM
Does this means the class attributes are not polymorphic? No, fields aren't polymorphic. You've actually got two fields in your Elephant class - one declared in Animal and one declared in Elephant, which hides the one in Animal.... more 9/27/2014 7:05:00 AM
You've declared separate name and price variables in Car, and never assigned a value to them - they're not the same as the name and price variables declared (and initialized) in Transport. So you're seeing the default values for String... more 9/26/2014 8:32:47 PM