Browsing 7239 questions and answers with Jon Skeet
One simple way, assuming it's a jar file: Make sure the jar file is in your project directory (so it should show up in package explorer) Right-click the project root Choose "Build path" / "Configure build path..." Go to the "Libraries"... more 9/21/2013 3:29:40 PM
How can I get Form1 to read the textfields in Form2? Presumably Form1 creates an instance of Form2... so hold on to that instance, and expose appropriate properties on the form: Form2 form2 = new Form2(); form2.Show(); // Or... more 9/21/2013 3:19:06 PM
Personally I would take a slightly different approach. You're not actually trying to say that a button was clicked - you're just interested in the same side effects as a button click. So extract a third method which only has the relevant... more 9/21/2013 8:07:30 AM
I strongly suspect that when you run it locally, you're in a culture where , is the decimal separator rather than . - and perhaps . is the thousands separator, which is basically ignored. So 1.5 ends up being parsed as 15 hours, which is... more 9/21/2013 7:22:48 AM
Just use the TimeOfDay property: if (currentTime.TimeOfDay == endTime.TimeOfDay) ... although I suspect you want to use >= instead of ==. If you do, be careful of the situation where endTime is just before midnight... if currentTime... more 9/21/2013 7:18:17 AM
Your implementation is already correct. The "laziness" aspect (only calling b.isActive() if a.isActive() returns true) is taken care of by the behaviour of the && operator, which is short-circuiting. From section 15.23 of the... more 9/21/2013 6:05:57 AM
Is there something simple and probably obvious I'm missing? Yes - you haven't overridden toString in TriviaQuestion, so you're getting the default implementation from Object: The toString method for class Object returns a string... more 9/21/2013 5:13:01 AM
I can not use the join method as I don't want the next one to wait for the other to finish entirely before starting, I do want them to be running at the same time. You could make them populate an array (where each one "knows" the... more 9/20/2013 9:37:47 PM
How does the .Contains() method perform the comparison? It uses the default equality comparer for the type, as documented: This method determines equality by using the default equality comparer So essentially, something like... more 9/20/2013 9:32:54 PM
You need to use NumberFormat.getCurrencyInstance(...), and then use that to format your value. For example: public String toString() { NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(Locale.US); return "\nOnline... more 9/20/2013 9:07:32 PM