Browsing 7239 questions and answers with Jon Skeet
Can this be always generalised and be said that in the import statement, the first one would be java/javax (is there any other?), the second one package, the third class and the fourth, if any will always be a method belonging to the... more 3/25/2015 6:12:54 PM
But the actual output was [...] Not with the code you posted. The code you posted wouldn't compile, because: You didn't end the field initialization with a semi-colon If you had, you'd be trying to access an instance field without... more 3/25/2015 4:10:47 PM
Basically, you've got two characters there: '\70' and '0'. The escape sequence for octals is documented in the JLS as: OctalEscape: \ OctalDigit \ OctalDigit OctalDigit \ ZeroToThree OctalDigit OctalDigit The last of these doesn't... more 3/25/2015 2:33:58 PM
I suspect the simplest way to do this is just to pass the PeriodType into the constructor instead: new Period( startDate.toLocalDateTime(), endDate.toLocalDateTime(), PeriodType.time()); Then you don't need to perform any... more 3/25/2015 12:03:59 PM
It works for me - but I suspect the problem is that you're letting the Timer get garbage collected: After the last live reference to a Timer object goes away and all outstanding tasks have completed execution, the timer's task... more 3/25/2015 11:51:47 AM
Okay, assuming you really want it to be "30 days" in the default time zone, I would use something like: // Implicitly uses system time zone and system clock ZonedDateTime now = ZonedDateTime.now(); ZonedDateTime thirtyDaysAgo =... more 3/25/2015 11:08:33 AM
No, a parameter can't have more than one value. So you'll need to change your method to accommodate what you need, e.g. by changing the parameter so that it's a collection of strings instead of a single string. You could change the... more 3/25/2015 10:32:13 AM
You're not only skipping alternate characters - you're also skipping characters whose UTF-16 code unit isn't even: if (c[i] % 2 == 0) That rules out 'o' (U+006F) twice, which is why you're getting "Hll" instead of "Hlool". It's not... more 3/25/2015 9:49:07 AM
No, this is not okay. 1) You're using Encoding.Default in various places. Don't do that - it means you're at the whim of the platform you're on. Always use an explicit encoding, ideally UTF-8 in most cases. 2) You're using... more 3/25/2015 9:28:01 AM
The error message is unfortunate, but it's not unfortunate that you can't do it... you're trying to access a member of a type, rather than a member of an instance of the type, but you're doing so "via" an instance. Basically, it's the... more 3/25/2015 9:06:52 AM