dimanche 18 septembre 2016

How would do I use if-else statements in Java with multiple different types statements

I was wondering how you can have different if-else statements in java. Like if I had single and married. Would it be:

if (status == 'S' || status == 's')
        {
            //print your own thing here
        }

        // testing if the character is an upper or lowercase 'm'
        else if (status == 'M' || status == 'm')
        {
            //print your own thing here
        }

Aucun commentaire:

Enregistrer un commentaire