s3a
September 8th, 2009, 03:37 AM
The following is a sample piece of code I have:
import javax.swing.JOptionPane;
public class If
{
public static void main (String [] args)
{
double number;
String input;
input = JOptionPane.showInputDialog("Enter a number");
number = Double.parseDouble(input);
if (number >= 5.0)
JOptionPane.showMessageDialog(null, "Big");
if (number < 5.0)
JOptionPane.showMessageDialog(null, "Small");
System.exit(0);
}
}
Why doesn't this work and how can I make it work?:
import javax.swing.JOptionPane;
public class If
{
public static void main (String [] args)
{
int number;
String input;
input = JOptionPane.showInputDialog("Enter a number");
number = Int.parseInt(input);
if (number >= 5.0)
JOptionPane.showMessageDialog(null, "Big");
if (number < 5.0)
JOptionPane.showMessageDialog(null, "Small");
System.exit(0);
}
}
import javax.swing.JOptionPane;
public class If
{
public static void main (String [] args)
{
double number;
String input;
input = JOptionPane.showInputDialog("Enter a number");
number = Double.parseDouble(input);
if (number >= 5.0)
JOptionPane.showMessageDialog(null, "Big");
if (number < 5.0)
JOptionPane.showMessageDialog(null, "Small");
System.exit(0);
}
}
Why doesn't this work and how can I make it work?:
import javax.swing.JOptionPane;
public class If
{
public static void main (String [] args)
{
int number;
String input;
input = JOptionPane.showInputDialog("Enter a number");
number = Int.parseInt(input);
if (number >= 5.0)
JOptionPane.showMessageDialog(null, "Big");
if (number < 5.0)
JOptionPane.showMessageDialog(null, "Small");
System.exit(0);
}
}