Browsing 7239 questions and answers with Jon Skeet
Is LinkText a method. Yes. I thought methods are similar to functions. That's right. How is ClassName MethodName is used here. In the declaration? That just indicates what the method returns. So to pull this declaration... more 12/14/2013 10:57:21 AM
You can filter by the return type of the property. I suspect you want to filter out anything that implements IEnumerable, but isn't string (which implements IEnumerable<char>, but which you want to keep). So something like: var... more 12/14/2013 9:24:20 AM
EDIT: Working out the period starting at a particular date is pretty easy with Joda Time. For example: public Period getMonthsAndDays(int days, LocalDate start) { LocalDate end = start.plusDays(days); return new Period(start, end,... more 12/13/2013 11:30:37 PM
Yes, in Java (unlike C#, for example) field initializers are called after the superclass constructor. Which means that any overridden method calls from the constructor will be called before the field initializers are executed. The... more 12/13/2013 11:01:39 PM
(When using new.) It doesn't even get to the new Foo(int i) method. Yes it does - but it executes the BaseClass implementation of Foo(int) because it's not overridden in the derived class. That's the whole point of new - it's... more 12/13/2013 10:56:57 PM
Yes, an exception is being thrown, for exactly the reason you describe - you're just catching it and swallowing it: catch(Exception x){} Don't do that. Never do that. Just doing this: catch (Exception x) { ... more 12/13/2013 10:53:03 PM
Your classes are currently inner classes, which need to be constructed in the context of instances of the containing class. Your options are: Specify an instance of the outer class when constructing an instance of the inner class Declare... more 12/13/2013 10:23:27 PM
This is the problem: counts[n.charAt(i)]++; n.charAt(i) is a character, which will be converted to an integer. So '0' is actually 48, for example... but your array only has 10 elements. Note that the working version isn't subtracting... more 12/13/2013 3:15:07 PM
Your highest and lowest variables both start at 0. So if your numbers are all negative, you'll get a highest of 0, incorrectly. If your numbers are all positive, you'll get a lowest of 0, incorrectly. Just start off with highest =... more 12/13/2013 1:40:34 PM
You're calling os.toByteArray() before you've closed gzip and b64os - which means they've almost certainly got buffered data. (Aside from anything else, a base64 stream has to wait until it's closed to write out any padding.) Just move... more 12/13/2013 11:16:44 AM