Forum: Ruby Dec 12th, 2008 |
| Replies: 1 Views: 1,794 Yes, you need an internet connection... |
Forum: Ruby Dec 8th, 2008 |
| Replies: 1 Views: 1,740 Use == to compare values; = performs assignment, not comparison. |
Forum: Java Nov 20th, 2008 |
| Replies: 2 Views: 416 Your post did not get formatted correctly. Please edit it to use code tags. |
Forum: Java Nov 11th, 2008 |
| Replies: 5 Views: 448 [QUOTE=VernonDozier;732999]
public void init ()
{
String stringWidth = getParameter("width");
String stringHeight = getParameter("height");
int width =... |
Forum: Java Nov 11th, 2008 |
| Replies: 5 Views: 448 Applets shouldn't have constructors because an applet isn't guaranteed to have a full environment until init is called. So the code you would normally put in your constructor should go into the... |
Forum: Java Nov 11th, 2008 |
| Replies: 3 Views: 362 This topic was recently discussed (http://www.daniweb.com/forums/thread155995.html). |
Forum: Java Nov 10th, 2008 |
| Replies: 3 Views: 484 It's not just a convention, it's a good programming practice. If you incorrectly attempt to override a superclass's method without the annotation, your error will be silently ignored. If you do... |
Forum: Java Nov 10th, 2008 |
| Replies: 28 Views: 1,708 Then I was correct in my last response.
Again, in Ruby, what you just described would look like this:
button_name = "button1"
eval(button_name).whatever # calls whatever() on the variable button1 |
Forum: Java Nov 9th, 2008 |
| Replies: 3 Views: 440 I'll go through each of the errors I see.
1) new int[5] //Constructing the array
This line does nothing useful and is missing a semicolon. You should remove the line completely.
2) int[0] =... |
Forum: Java Nov 9th, 2008 |
| Replies: 6 Views: 473 You need to use the getWidth() and getHeight() methods.
Here's a rough draft of my version:
import java.awt.*;
import javax.swing.*;
public class GrowingBall extends JApplet {
... |
Forum: Java Nov 9th, 2008 |
| Replies: 28 Views: 1,708 I still don't understand the question entirely, but in many scripting languages you can evaluate any given string as if it were code.
Example in Ruby:
var = "Hello, world!"
puts var # prints:... |
Forum: Java Nov 9th, 2008 |
| Replies: 4 Views: 402 http://forums.devshed.com/java-help-9/java-help-plz-569400.html |
Forum: Java Nov 9th, 2008 |
| Replies: 28 Views: 1,708 If you have two hundred buttons you should store them in an array. |
Forum: Java Nov 8th, 2008 |
| Replies: 28 Views: 1,708 Java doesn't support creating variable names dynamically. |
Forum: Ruby Nov 8th, 2008 |
| Replies: 1 Views: 2,117 Objects are destroyed for you by the garbage collector. |
Forum: Java Nov 8th, 2008 |
| Replies: 4 Views: 4,561 You'd compare an object to null with ==. I think you want one of the following. It's hard to determine the exact behavior you're looking for from your code.
if (child == null)
child = new... |
Forum: Java Nov 8th, 2008 |
| Replies: 2 Views: 581 Keep in mind you aren't looping here, so the sum variable is not doing anything useful.
You can rewrite javaAddict's code to be like this:
public static int myMethod(int counter) {
if... |
Forum: Java Nov 8th, 2008 |
| Replies: 10 Views: 827 You can read more about it here (http://leepoint.net/notes-java/oop/constructors/constructor-super-example.html). |
Forum: Java Nov 7th, 2008 |
| Replies: 10 Views: 827 You do need it. But it's there implicitly. It works because that superclass has a constructor that takes no arguments. |
Forum: Java Nov 7th, 2008 |
| Replies: 10 Views: 827 We posted at the same time. |
Forum: Java Nov 7th, 2008 |
| Replies: 10 Views: 827 A superclass must always be constructed before its children. There are two things that are implicit in your MainClass class.
1) Since you did not specify any constructors, you have an implicit... |
Forum: Java Nov 7th, 2008 |
| Replies: 3 Views: 1,092 You have to compare each one explicitly.
boolean invalidColor = (FColour != 'B' && FColour != 'L' && FColour != 'W' && FColour != 'R' && FColour != 'Y' && FColour != 'G'); |
Forum: Java Nov 7th, 2008 |
| Replies: 1 Views: 363 Every class has a hashCode method. Just don't use the URL class for this because it's broken. use the URI class. |
Forum: Java Nov 7th, 2008 |
| Replies: 29 Views: 1,538 No, reread what you/he wrote.
I'm not saying he was suggesting making it a public variable, just that in the context of his comment, he meant public variable. |
Forum: Java Nov 7th, 2008 |
| Replies: 2 Views: 339 The java.util.Stack class is a legacy class. You should use the java.util.Deque interface instead, which supports LIFO. |
Forum: Ruby Nov 7th, 2008 |
| Replies: 5 Views: 2,912 Try specifying the proxy in the gem command with sudo gem install rails -p [proxy url]:[port]. If that doesn't work, try setting the environment variable with set HTTP_PROXY=[proxy url]:[port] |
Forum: Ruby Nov 6th, 2008 |
| Replies: 5 Views: 2,912 Do you have a firewall that's getting in the way? |
Forum: Java Nov 6th, 2008 |
| Replies: 5 Views: 924 Is this just a syntax question? Because your psuedocode is (nearly) correct.
// MyObject is the class of the object you want to compare
public boolean(MyObject obj1, MyObject obj2){
if... |
Forum: Java Nov 6th, 2008 |
| Replies: 16 Views: 2,068 Chances are he's doing it wrong.
Yes, in this case it does, but that's irrelevant to my point.
Right, but I was clarifying for the other posters since they thought that casting to a char... |
Forum: Java Nov 6th, 2008 |
| Replies: 16 Views: 2,068 How do you know what format the OP saved his file in?
What? My point was that if you read in data from a file and get unexpected results (such as Asian characters, in this case) then you are... |
Forum: Java Nov 6th, 2008 |
| Replies: 29 Views: 1,538 No, he meant public variable. He/she was saying that the OP should be saying myCircle.getRadius() instead of myCircle.getRadius (notice the parentheses). In the latter case, you would need to declare... |
Forum: Java Nov 6th, 2008 |
| Replies: 3 Views: 391 The Math class is imported by default; you don't need to import it manually.
masijade was suggesting that you look in that class for a method that might be useful to you. |
Forum: Java Nov 6th, 2008 |
| Replies: 29 Views: 1,538 You mean public variable. |
Forum: Java Nov 6th, 2008 |
| Replies: 6 Views: 473 These should really be two separate threads, but that's alright.
Let's look at your applet first. There are a couple of problems with it. Mainly, you stuck all of your logic into the paint method.... |
Forum: Java Nov 6th, 2008 |
| Replies: 6 Views: 473 Can you edit your post to include code tags please?
your code here |
Forum: Java Nov 6th, 2008 |
| Replies: 16 Views: 2,068 Yup, I edited my post a minute before you posted this. |
Forum: Java Nov 6th, 2008 |
| Replies: 16 Views: 2,068 Beat you to it. :)
And to unconfuse you, read my post above and you'll see that an EOFException is an IOException. |
Forum: Java Nov 6th, 2008 |
| Replies: 2 Views: 684 Try Googling "validating JTextField."
First result was your question covered in depth: http://java.sun.com/developer/JDCTechTips/2001/tt1120.html |
Forum: Java Nov 6th, 2008 |
| Replies: 16 Views: 2,068 Note that IOException is a superclass of many classes (you can see a list at its documentation (http://java.sun.com/javase/6/docs/api/java/io/IOException.html)). If you put e.printStackTrace(); in... |
Forum: Java Nov 5th, 2008 |
| Replies: 2 Views: 1,092 You have all the right logic, you're just missing half a line. Looks like a silly mistake on your part.
char c = word.charAt(0);
reverseWord += reverse(word.substring(1));
reverseWord += c; |