Browsing 7239 questions and answers with Jon Skeet
You're only recompiling Test.java each time. If you try to recompile everything, you'll see the error again. I don't honestly remember the details about how javac works out what to recompile - whether it checks source vs class file... more 9/14/2017 1:54:19 PM
Firstly, no, this wouldn't work in C# - not when you're actually overriding the method. (It will work if you use new, but then you're not overriding.) C# is more strict than Java, in that the return types do have to match exactly...... more 9/14/2017 10:57:25 AM
Create an IEqualityComparer<Person> implementation that defines how you want the values to be compared. You can then use var distinctByNameAndAddress = people.Distinct(comparer).ToList(); Your equality comparer would look... more 9/13/2017 7:40:01 AM
The compiler only knows that gameObject is of type Sprite (I assume; it's hard to tell for sure). Your if condition doesn't change that. Instead, you can use: if (gameObject is Player player) { // Now use player instead of... more 9/13/2017 7:36:59 AM
You can only use the instanceof with the name of a type, known at compile-time. You can fix the first part using the Class.isInstance method: if (c.isInstance(cand)) ... but that's not going to help you with... more 9/12/2017 9:02:40 PM
.NET Standard is a set of library contracts. Each version includes all the contracts of the previous version - so everything in netstandard1.4 is in netstandard1.5 for example. .NET Core is an implementation of .NET Standard (and some... more 9/11/2017 7:35:03 AM
I'd go with ArgumentOutOfRangeException. That fits in with other examples elsewhere in the framework: string.Substring(int, int) throws AOORE if "startIndex plus length indicates a position not within this instance." Array.Copy(Array,... more 9/10/2017 7:35:44 AM
Calculate the right side, ++i No, that's not the first step. The first step is to evaluate the original value of the left side. Then evaluate the right side. Sum them, and assign the result to the variable. So i += ++i; is... more 9/9/2017 7:32:33 PM
It's trivial - there's a string constructor that does it already: string text = new string('z', 5); // "zzzzz" more 9/8/2017 11:54:48 AM
Instance initializers were added in Java 1.1. Old versions of language documentation are somewhat spread around the web (Oracle hasn't kept a lot of them) but this document appears to be a copy of original tutorial docs, and shows the... more 9/8/2017 10:19:44 AM