Browsing 7239 questions and answers with Jon Skeet
You've got several variables all called allProducts: The static variable The parameter in InitialiseMyProducts The local variable in Main You're initializing the local variable in Main twice, then passing it to InitialiseMyProducts (or... more 5/4/2014 6:41:54 AM
The problem is that arguments to methods are passed by value in Java. So the part at the end of displayMenu where you set a new value for the selection parameter doesn't change the value of the selection local variable in main at all. So... more 5/3/2014 7:45:27 PM
Java's compiler, at least the one from Oracle that I use, refuses to recognize System.exit() as a procedure termination. Yes, it would. As far as the compiler is concerned, it's just a void method. There's no way of indicating "this... more 5/3/2014 3:45:34 PM
I think you're getting confused by time zones. The Z at the end of the string indicates that it's in UTC. When you posted this question, it was just after 15:30 UTC. I strongly suspect that the correct instant in time is being recorded -... more 5/3/2014 3:39:22 PM
As the error message is saying, you need to pass the type of the enum as the first argument. You also need to change the type of myValue to match the out parameter of EnumTryParse, so: object myValue; if... more 5/3/2014 10:09:09 AM
Well your method is already broken, in that it won't consider all the strings - if you have {"foo", "bar", "ab", "cd" } then you'll still be left with "bar" afterwards, because of the way you're iterating. It's generally a pain to mutate... more 5/3/2014 6:05:01 AM
No, a static variable lives for as long as the classloader which loaded the class does. So that's "forever" in many applications. It's not clear what you're trying to achieve, but this code is almost certainly a bad idea. (In general,... more 5/2/2014 8:07:17 PM
i know Tehran is a GMT offset of +03:30 Well, that's its offset from UTC in standard time, but it's currently observing daylight saving time (details). So the current UTC offset is actually +04:30, hence the difference of an hour. I... more 5/2/2014 5:21:45 PM
I would strongly advise you to have separate property files, one for each language. Heck, that's the scenario that PropertyResourceBundle is made for. Fundamentally you can't tell what language a word is - there are many words which are... more 5/2/2014 5:15:04 PM
No, file.lastModified() is returning 0. That's the Unix epoch In your particular time zone (Eastern US by the looks of it), local time at the Unix epoch was 5 hours behind UTC, so it was 7pm on December 31st 1969. To confirm this, just... more 5/2/2014 5:00:06 PM