Forum: Java Dec 10th, 2007 |
| Replies: 2 Views: 2,067 I haven't written any I/O Java code in a while, but I do remember using java.io.PrintStream which is a buffered stream, so you don't need to create a whole mess of inline class instances.
import... |
Forum: Java Aug 5th, 2007 |
| Replies: 14 Views: 2,311 So?
I learned Java just so I knew at least one, non-Smalltalk-based, OOP language.
I'm still making use of other classes within the program (javax.swing.JFrame, javax.swing.JButton, etc.). I... |
Forum: Java Aug 5th, 2007 |
| Replies: 14 Views: 2,311 What you've got is a good start. Here's how I would do it:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class GuessGame extends JFrame {
private static JButton... |
Forum: Java Aug 5th, 2007 |
| Replies: 14 Views: 2,311 Sweet. :)
Alright. I looked over the code you have, and I would do it much differently than you have done it (while still staying within the requirements).
Get rid of the constructor for the... |
Forum: Java Aug 4th, 2007 |
| Replies: 14 Views: 2,311 That's fine, but having the loop repeatedly call Integer.parseInt() is just going to re-parse the first number it comes across (if they're separated by spaces) or it will just mush all of the... |
Forum: Java Aug 4th, 2007 |
| Replies: 14 Views: 2,311 One thing I would not do is declare a variable inside of a loop:
...
for (int i = 0; i < 5; i++) {
int n = Integer.parseInt(t.getText());
...
Put this instead:
public void compare(int x)... |