Browsing 7239 questions and answers with Jon Skeet
Yes, because the second "subarray" doesn't have 4 elements. It would be better to do this dynamically: // Note preferred syntax for array types - keep all the type info in one place. int[][] array1 = {{1,2,3,4},{5},{6,7}}; for (int i = 0;... more 11/26/2014 1:22:08 PM
This statement: ObjectOutputStream objectOS = new ObjectOutputStream(new FileOutputStream("ClassList.data")); ... overwrites the existing file with an empty file. You then try to read an object from that empty file. You should... more 11/26/2014 12:54:31 PM
You can't do this automatically - it's simply not a feature of Java property files. You'll need to write code to do this wherever you plan to load/use the properties file. You should think about: whether you want to make this more... more 11/26/2014 10:04:14 AM
Both are correct :) The this value is passed as a first "invisible" parameter to instance methods, so in an instance method, ldarg.0 is "load the this value". You can see the difference if you write a method which uses a different... more 11/26/2014 7:19:48 AM
You can't, basically - not with just ICollection (or even ICollection<T>). Neither of them allow you to replace an existing element with a new one. With IList<T>, it's pretty easy: var list =... more 11/25/2014 6:07:56 PM
I open two console windows and do java Hi in first one. Then wait for about 10 seconds seconds and do the same in the second window. You're starting two entirely separate process. That's not using multithreading at all - each process... more 11/25/2014 5:59:13 PM
The design here is that the first and last names always have to be set, but the age is optional. (I would have used Integer here, rather than defaulting to 0... but then I'd prefer to use a birthDate anyway... but I digress.) That... more 11/25/2014 5:34:47 PM
You're using the String(byte[]) constructor without specifying an encoding. Don't do that. Likewise, don't call String.getBytes() without specifying the encoding, either. You're doing that twice in the code you've shown us - and my guess... more 11/25/2014 2:39:44 PM
It's not performing a join at all, in terms of LINQ understanding. It's just filtering based on two properties where one happens to come from one range variable and the other happens to come from the other. In method syntax you'd write... more 11/25/2014 2:19:30 PM
The difference is that usually a cast can perform a user-defined conversion if the compiler knows about one. For a generic type, the compiler doesn't have that information. If you want to just perform a straight reference conversion cast,... more 11/25/2014 2:16:58 PM