Browsing 7239 questions and answers with Jon Skeet
How would you expect the compiler to know that it is a Truck? You've declared a list of vehicles. Imagine if you were using list.get(0) instead of list.get(3) - then the value would be a reference to a Motorcycle, not a Truck. You can fix... more 10/25/2013 11:01:15 AM
Well clearly createBigInteger is doing more work - it's checking for nullity, when you know the argument value won't be null anyway. That's only a tiny, tiny bit of extra work though - almost certain to be irrelevant in reality. I'd be... more 10/25/2013 10:01:42 AM
I think you've misunderstood how classes work. Any kind of class is "available" throughout the lifetime of the app. Memory used for the class itself (the methods etc) is very different to memory used by instances. Unless you actually... more 10/25/2013 8:24:12 AM
You're trying to add Java source files as if they're libraries - they're not. Add the "src" directory as a Source Path (leftmost tab in the Java Build Path settings) instead. Or if that's already a source path, try refreshing it in... more 10/25/2013 7:11:39 AM
You're redeclaring selectedData in the if and else bodies. You don't want to do that - you've already declared the variable earlier. You just need to change those statements into assignments to the existing variable. So this: var... more 10/24/2013 7:31:24 PM
double doesn't keep insignificant digits - there's no difference between 1.5 and 1.50000 as far as double is concerned. If you want to preserve insignificant digits, use decimal instead. It may well be more appropriate for you anyway,... more 10/24/2013 7:18:35 PM
From the docs for System.Single: All floating-point numbers have a limited number of significant digits, which also determines how accurately a floating-point value approximates a real number. A Double value has up to 7 decimal digits... more 10/24/2013 5:04:26 PM
This is the problem: while (input.nextInt()!=0); That asks for another number, but doesn't remember it - it just checks whether or not it's 0. I suspect you want something like: while (true) { System.out.print("Enter choice:"); ... more 10/24/2013 4:50:09 PM
No, there's no individual signature that can do this - there's no way of saying "the nullable type of R, which is either R itself for a reference type, or Nullable<R> for a non-nullable value type". You can have different methods,... more 10/24/2013 4:17:18 PM
You should use parameterized SQL instead of including the values directly within the call itself. So something like: // The ... is because I didn't want to count the huge number of parameters... // You'll need to fill in the right number... more 10/24/2013 2:47:32 PM