Browsing 7239 questions and answers with Jon Skeet
I suspect this is the immediate problem: navn += delnavn1 + delnavn2 + " "; You're concatenating with the previous value of navn. So if you start off with "Hello there", when you get to the first space you'll have: delnavn1 = "... more 3/4/2015 9:24:31 PM
I want datetime.now to return the datetime object in UK format. There's no such concept, any more than an int is a value "in hex" or "in decimal". A DateTime is just a DateTime - you can specify the format when you convert it to a... more 3/4/2015 8:24:00 PM
The error disappears because your code is now valid. (Not nice, but valid.) If a finally block just has a straight return; statement, then the overall try/catch/finally or try/finally statement can't throw any exceptions - so you don't... more 3/4/2015 6:06:35 PM
Basically, it's due to section 7.6.9 of the specification: The operand of a postfix increment or decrement operation must be an expression classified as a variable, a property access, or an indexer access. The result of the operation... more 3/4/2015 5:00:14 PM
This is the problem: new Date(Input) You should not use that. Instead, construct a SimpleDateFormat to parse your input: import java.text.*; import java.util.*; public class Test { public static void main(String[] args) throws... more 3/4/2015 2:40:52 PM
You're not really making a constructor call in the normal way, even though that's what it looks like. Instead, this is a delegate-creation-expression as described in the C# 5 specification, section 7.6.10.5: A... more 3/4/2015 11:03:34 AM
Arrays.asList returns a List implementation, but it's not a java.util.ArrayList. It happens to have a classname of ArrayList, but that's a nested class within Arrays - a completely different type from java.util.ArrayList. If you need a... more 3/4/2015 10:11:35 AM
I suspect the problem is that you need to specify an IANA time zone ID rather than just an abbreviation. Time zone abbreviations are really problematic for various reasons: They usually indicate "half" a time zone; "Europe/London"... more 3/4/2015 9:31:35 AM
You should be using hh:mm:ss tt as the format string - HH is for the 24-hour clock, at which point you're saying it's 4AM... but with PM as the AM/PM signifier. Basically, use hh with tt, or HH on its own. Using Noda Time, you'd... more 3/3/2015 10:03:11 PM
It's not clear why you're calling getDeclaredMethods via reflection, but the invocation of main is broken because you're trying to call it as if it had several String parameters - one per value in args. Instead, you want to pass a single... more 3/3/2015 3:20:11 PM