Browsing 7239 questions and answers with Jon Skeet
This is the problem with calling virtual methods in a constructor... The order of execution is: BaseFoo variable initializers BaseFoo constructor body Foo variable initializers Foo constructor body That behaviour is well documented in... more 10/18/2013 9:39:47 PM
You just need to create an array of objects - you can't create an instance of Monitor; it's a static class. (I'm surprised you can even declare the array - although it's not clear why you've decided to use fixed sized buffers, either.... more 10/18/2013 5:03:51 PM
Why does "super.add(new Surface()); work, but ""SampleAddMethod.add(new Surface());" fail? Because add(Component) is an instance method on Container, basically - and SampleAddMethod is a subclass of Container, indirectly. So the add... more 10/18/2013 4:24:09 PM
You wouldn't, within pure Java. It's just about the opposite of a lot of what Java is about. You could do so with JNI if you really wanted to. Ideally, you'd change your design so that you didn't need to do this though - it's a pretty odd... more 10/18/2013 3:36:15 PM
Yes, you can use it as an identifier using @: public enum LoadPolicy { @default, at_start, in_background } From the C# 5 spec, section 2.4.2: The rules for identifiers given in this section correspond exactly to those recommended by... more 10/18/2013 3:06:25 PM
Simply put, System.console() is returning null in Eclipse, but not when run in a console. This is the documented behaviour: Returns the unique Console object associated with the current Java virtual machine, if any. Returns: The... more 10/18/2013 2:29:11 PM
The most dynamic types ins C# rely on IDictionary<string,object> Not necessarily. ExpandoObject does, but there are plenty of other ways of being dynamic, and DynamicObject doesn't. Note that reference conversion casting... more 10/18/2013 2:01:10 PM
Your code uses FileWriter. That will always use the platform default encoding - and the detection of that may well vary between running it in Netbeans and running it as an applet. I would strongly suggest that you change the code to... more 10/18/2013 1:47:38 PM
Why does it happen? Because ASCII only contains values up to 127. When faced with binary data which is invalid for the given encoding, Encoding.GetString can provide a replacement character, or throw an exception. Here, it's using a... more 10/18/2013 1:36:02 PM
You're calling BeginInvoke, which is asynchronous - it will execute the given delegate in the UI thread, but not block the currently executing thread... which means it's highly likely that you'll end up using the variables in the rest of... more 10/18/2013 1:10:16 PM