Browsing 7239 questions and answers with Jon Skeet
Your nested class is a static nested class: private static class GetBinaryThread extends Thread Therefore it doesn't have an enclosing instance. Get rid of static and then it'll be an inner class, with a reference to an instance of... more 8/14/2015 8:30:32 PM
Even though I have overridden the default method, if I use Arrays.sort, it calls the default compare instead of my overridden method. Is this because I am explicitly calling the super class method? No, it's because in the example... more 8/14/2015 8:23:46 PM
One option would be to wrap all but the doNormalThing method call in another method that returns whether or not to execute doNormalThing afterwards: void myMethod(String arg1) { if (myMethodInternal(arg1)) { doNormalThing(); ... more 8/14/2015 5:41:39 PM
(Just to be clear, the explanation I'm giving here is specific to Java and C#. Don't assume it applies to other languages, although bits of it may.) I like to use an analogy of telling someone where I live. I might write my address on a... more 8/14/2015 12:33:57 PM
You're calling toString() from your anonymous inner class - the new Runnable() { ... }. That means you're calling toString() on your anonymous class instance, not on the Timer instance. I suspect you're getting a $1 in the output, showing... more 8/14/2015 12:29:40 PM
Firstly, don't forget that this is deliberately bizarre code, used to find a corner case. If you ever find a type that behaves like this in a genuine program, find the author and have a quiet word with them. Still I don't understand :... more 8/14/2015 11:54:14 AM
In your project properties, under the Build tab, in "Errors and warnings", add IDE0001 to the set of suppressed warnings. I know this isn't really a warning (just a suggestion) but it's the same infrastructure. That removes the suggestion. more 8/14/2015 9:05:19 AM
The code you've got doesn't match the output you've shown - it's nearly right already. It comes up with: java 100 cpp 065 python 060 The only problem here is that you're right-padding the names to a minimum of 5 characters... but... more 8/14/2015 7:37:50 AM
You need to use the type arguments where you specify the interface: public static void DoAction<TReturnType, TParameterType> (IStoredProcedure<TReturnType, TParameterType> procedure1) where TReturnType : class where... more 8/14/2015 6:24:03 AM
I'm pretty sure you want || instead of &&. Currently, you're only throwing an exception if both lines are invalid - if the first line is valid, you're never even parsing the second. I assume you actually only want to use number and... more 8/13/2015 5:43:07 PM