import javax.swing.JOptionPane;
public class Sentinel
{
public static void main(String[] args)
{
int input=1;
while(input !=0 )
{
String s1 = JOptionPane.showInputDialog("Enter your choice, 0 to end");
input = Integer.parseInt(s1);
if(input==1)
System.out.println("chocolate selected");
else
if(input==2)
System.out.println("Candy selected");
else
System.out.println("Nothing selected");
}
}
}
Wednesday, 24 January 2018
Related Posts:
Simple Addition In javapublic class addition { public static void main(String[] a… Read More
Read string in javaimport java.io.*;public class ReadString { public static v… Read More
simple java programspublic class Hello { // start attributes // … Read More
Joption pane in java import javax.swing.*;public class JOptionPaneShowInputDialogExample{&n… Read More
0 comments: