Browsing 7239 questions and answers with Jon Skeet
You appear to be expecting to be able to reference constants from KeyEvent without either importing them or qualifying them. You should either have: row1.add(createButton(KeyEvent.VK_DEAD_TILDE, "~")); Or add: import static... more 10/30/2015 3:18:59 PM
There's AtomicReference<T> which is what I'd normally use. final AtomicReference<String> ref = new AtomicReference<String>(); final Runnable runnable = new Runnable() { public void run() { ref.set("Hello... more 10/30/2015 2:14:47 PM
If a Stream returns true from CanSeek, it assumed that Length, SetLength, Position and Seek are all supported. Some code may test CanSeek and use the result to optimize its behaviour - as seems to be the case here. When you return true... more 10/29/2015 8:30:29 PM
(Answered before the .NET 2.0 requirement was mentioned - it may still be useful for others.) You can use a Dictionary<string, dynamic> instead - at which point the compile-time type of the expression dict["stringObject"] will be... more 10/29/2015 11:57:21 AM
You're converting the String to a BigDecimal with no problems. The BigDecimal value has no notion of whether the value has exponential notation or not... it's just a scaled value. The problem you're seeing is when you implicitly call... more 10/29/2015 11:42:04 AM
You can use javap (with -v for verbose mode), and specify any class from the jar file. For example, looking at a Joda Time jar file: javap -cp joda-time-2.7.jar -v org.joda.time.LocalDate Here the -cp argument specifies the jar file to... more 10/28/2015 4:13:17 PM
Most types in Joda Time (at least the ones you should use) are immutable. You can't change their value - but you can call methods which return a new value. You're calling the right method in this case, but you need to remember the result,... more 10/26/2015 8:48:26 PM
The compiler doesn't consider a != 0 and a == 0 to be mutually exclusive conditions - or rather, it doesn't look at whether two if conditions are mutually exclusive to work out what happens. So you can fix the error by changing your code... more 10/26/2015 8:42:27 PM
In ShoppingCart class, there's private LinqValueCalculator calc; from my understanding we are creating an object from that class No, it doesn't. It declares a variable of that type, but it doesn't create any objects. Initially, that... more 10/24/2015 11:16:14 AM
Firstly, you would have fewer problems if you followed Java naming conventions - currently Catalog is both an array variable name and a type name. Secondly, there is no add method in arrays. You may want a List, e.g. ArrayList.... more 10/24/2015 3:36:52 AM