Browsing 7239 questions and answers with Jon Skeet
There's no equivalent to anonymous inner classes in C#. For single-method versions, you can often use delegates instead of interfaces, then use lambda expressions (or just regular methods) to specify an implementation. Otherwise, just use... more 1/15/2015 4:18:57 PM
It looks like this isn't supported. From the custom TimeSpan format strings page: Custom TimeSpan format specifiers also do not include a sign symbol that enables you to differentiate between negative and positive time intervals. To... more 1/15/2015 2:30:57 PM
Although the output of path is: \\\\myServer\myFile.txt No, it's not. The value you might see in the debugger would be \\\\myServer\\myFile.txt which is just the debugger escaping the value for you. The value of the string has... more 1/15/2015 1:02:46 PM
args[0] will refer to the first command line argument, e.g. java Foo filename.txt If you want it on the interactive console, i.e. after the program has started, you should use System.in, e.g. BufferedReader reader = new... more 1/15/2015 7:06:37 AM
If they are genuine constants, introduced with const, then the value of each constant will be inlined where it's used. For example, if you have: // Assembly1 public static class Constants { public const string Foo = "Hello"; } //... more 1/14/2015 4:51:44 PM
For a void method, there's no point. For a method with a return type, it shows that it won't return null: @NonNull String foo() { // I promise I won't return null herre! } Judging by the tutorial, it looks like it won't generate a... more 1/14/2015 4:39:00 PM
Are negative values expected for hashCode()? They're entirely valid, yes. won't the value keep increasing as the length of string increase and eventually be greater than Integer.MAX_VALUE? What makes you think that hash codes... more 1/14/2015 4:19:22 PM
Section 12.5 of the JLS gives the details. The bare bones of it is: Memory space is allocated (with all fields having the default value for the relevant type, e.g. null or 0) The specified class's constructor is called, which will... more 1/14/2015 4:08:57 PM
I believe it should actually be base-access: base . identifier type-argument-list_opt base [ expression-list ] ... which would make it just like member-access: member-access: primary-expression . identifier ... more 1/14/2015 2:01:59 PM
The idea is that it will add multiple animals of whatever type I pass in to the farmlist. In that case you need to pass in the type of an Animal - not a reference to an instance of an Animal, which is what you're doing at the moment.... more 1/14/2015 12:01:52 PM