Browsing 7239 questions and answers with Jon Skeet
What is index in the above linq query ? It's the index of the element being processed. So the first element (5) will have an index of 0, the second element (4) will have an index of 1 etc. How it brings the index from the array... more 11/8/2013 7:02:00 AM
To answer this line: Why isn't it convertible? They're different delegate types, and there's no reference conversion between different delegate types (other than in generic delegate types using generic variance). You can create an... more 11/8/2013 6:50:53 AM
The statements are completely independent of each other, so I am worried that the compiler may not respect the ordering in the code. No, it will. It's possible that other threads may observe the results of the operations out of order... more 11/7/2013 11:07:00 PM
The result is clazz= B T= A ????? why inference generic type doesn't take into account polymorphism ? Type inference is performed at compile time. The compile time type of the variable b is A, so the compiler infers that you... more 11/7/2013 10:52:10 PM
Look at your code: int[] a = null; char[] b = null; int r = 0; for (int i = 0; i <= text.length(); i++) { a[i] = text.charAt(i); } a is null - you've explicitly set it to null. So a[i] = text.charAt(i); will fail with a... more 11/7/2013 9:37:16 PM
You've misunderstood the API for Scanner. From the docs for the Scanner(String) constructor: Constructs a new Scanner that produces values scanned from the specified string. Parameters: source - A string to scan It's not a... more 11/7/2013 9:04:25 PM
The second argument Random.Next(int, int) gives an exclusive upper bound. So you're saying you want an integer greater than or equal to 0, and less than 1. That doesn't give a lot of scope for numbers other than 0 :) From the... more 11/7/2013 8:53:52 PM
(When I originally answered the question, the format string used hh - it has since been changed.) You're using hh for the hours part, which is a 12-hour format - but providing a string which uses "18". You want HH. Additionally, I'd... more 11/7/2013 7:02:28 PM
This is the problem: public Animal[] park; public Zoo() { Animal[] park = new Animal[10]; } You're declaring an instance variable called park - but then in the constructor, instead of assigning a value to that instance variable,... more 11/7/2013 11:58:16 AM
Fundamentally, you've got problems with time zones here. The fact that you're using a java.util.Date to represent a time of day is messing you up to start with. Your time of 11:51:14 CET is actually 10:51:14 UTC, so when you add the result... more 11/7/2013 11:50:12 AM