import javax.swing.JOptionPane;

public class If
{
public static void tryThis5()
{
char ch = 'j';
boolean upper = Character.isUpperCase(ch);
if (upper)
      JOptionPane.showMessageDialog(null, "uppercase");
else
      JOptionPane.showMessageDialog(null, "lowercase");
int k = 11;
if (0 < k && k < 100)
     JOptionPane.showMessageDialog(null, "small");
if (10 < k || k <= 10)
     JOptionPane.showMessageDialog(null, "Thursday");
}

// example of nested if statements
public static void tryThis4()
{
String day = "October 31";
boolean rainy = true;
String msg = "It's not Halloween";
if (day.equals("Halloween") || day.equals("October 31"))
    if (rainy)
         msg = "Oh no! Go to the indoor haunted house";
    else
         msg = "Get lots of goodies!";

JOptionPane.showMessageDialog(null, msg);
}

//comparing Strings
public static void tryThis3()
{ String msg = "";
String name = "Robert";
String nickname = name.substring(0, 3);
//if (nickname == "Rob") // don't do it this way
// if (nickname.equals("rOB")) // use .equals() to compare Strings

Try it this way:
     int result = "Thursday".compareTo("Thursday");
JOptionPane.showMessageDialog(null, result);

OR
if (nickname.equalsIgnoreCase("rOB"))
    msg = "Your name is Rob";
else
    msg = "Your nickname is not Rob";
JOptionPane.showMessageDialog(null, msg);
}

// don't compare doubles with ==
// instead, see if the difference between the 2 doubles
// is less than some very small value. see below.
public static void tryThis2()
{
double r = Math.sqrt(2);
double d = r * r - 2;
if (d <= 1e-14)
    System.out.println("sqrt(2) squared minus 2 is 0");
else
    System.out.println("sqrt(2) squared minus 2 is not 0 but " + d);
}

// multiple alternatives:
public static void tryThis()
{
// driver license rules
String msg = "";
String ageStr = JOptionPane.showInputDialog("Age? ");
int age = Integer.parseInt(ageStr);
if (age >= 18)
    msg = "Full adult license";
else if (age == 17)
    msg = "Probational license";
else if (age == 16)
    msg = "Learner's permit";
else
    msg = "You can't yet drive.";
JOptionPane.showMessageDialog(null, msg);
}

public static void main(String[] args)
{ If.tryThis5();
}
}