Browsing 7239 questions and answers with Jon Skeet
This is the problem: Attempting to write output directory D:\TestFile\1.png You've created the target filename as a directory. You need to separate out "the directory I need to exist" and "the file I want to write to". For... more 7/7/2014 7:57:13 AM
Did you read the documentation for the (deprecated) constructor you're calling? In particular: year - the year minus 1900 month - 0 to 11 I'd strongly advise you not to call that constructor to start with. If you're using Java 8,... more 7/7/2014 7:44:56 AM
I suspect you don't need the Translations class at all. You've got: An object containing a data property The data property value is an object containing a translations property The translations property value is an array Each element of... more 7/7/2014 7:31:41 AM
This is the problem: Convert.ToString(Encoding.ASCII.GetBytes(s)); Encoding.GetBytes(string) returns a byte[], and calling Convert.ToString() on that will just return System.Byte[]. It's not clear why you're using Encoding.ASCII at all... more 7/6/2014 9:48:54 PM
If A.foo() is private, then it can't be overridden by a subclass - any other class should basically be unaware of the existence of private members. You can't override a member you can't "see". From section 8.4.8.1 of the JLS: An... more 7/6/2014 8:59:46 AM
When I have 2 Threads that increment and decrement on a int variable than sometimes i still got race conditions. Yes, you will - because even though the "get" and "set" operations on the int variable are each atomic, that doesn't mean... more 7/5/2014 7:59:15 AM
No, because the reference is from the instance of MyClass to the instance of MyThreadPool. That means that the instance of MyClass would keep the instance of MyThreadPool alive, but not the other way round. The instance of MyThreadPool... more 7/5/2014 7:09:19 AM
(From comments...) My point is that I want to run this class and get the same instance every time. It sounds like you have a misconception about what singletons are. If you're running your app twice, i.e. $ java MyApp [output] $... more 7/4/2014 3:14:38 PM
That's in my component, will I be able to identify who created an instance of me? Not in general, no. You could try obtaining a stack trace in the constructor, but that's not necessarily reliable or helpful. If you want some sort of... more 7/4/2014 3:00:18 PM
You'd need to define "best". The default value is basically only applied to whichever type you try to call against. So for example, with your current code: MyClass c = new MyClass(); c.MyMethod(); // Invalid MyInterface i = new... more 7/4/2014 12:57:25 PM