View Single Post
Old 08-16-2012, 01:25 AM   PM User | #1
dannyboi
New Coder

 
Join Date: Jul 2012
Location: NYC
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
dannyboi is an unknown quantity at this point
"variable input might not have been initialized" ? Saying that after if statement?

Code:
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Main {
static Scanner sc = new Scanner (System.in); 
public static void main (String [] args) { 


int number = 2;
String input;

while (true)
{
  JOptionPane.showMessageDialog(null, number + "");
JOptionPane.showInputDialog(null,"Do you want to keep counting " + " Y or N");


if (input.equalsIgnoreCase("N"))
    break;
number +=2;
        JOptionPane.showMessageDialog(null, "\nWhew! That was close.\n");
        
}

}

}

Last edited by dannyboi; 08-16-2012 at 01:27 AM..
dannyboi is offline   Reply With Quote