If-else 2
package ifelse2;
import javax.swing.JOptionPane;
public class IfElse2
{
public static void main (String[] args)
{
String enter=JOptionPane.showInputDialog("Please enter a number");
int number=Integer.parseInt(enter);
if(number<0)>
System.out.println("The number you enter is "+number+",and "+number+" <0.");>
else if ((number>=0)&&(number<100))>
System.out.println("The number you enter is "+number+",and "+number+" between 0 and 100 (including 0).");
else
System.out.println("The number you enter is "+number+",and "+number+" >=100.");
}
}
0 Comments:
張貼留言
<< Home