Monday, October 18, 2021

If Statements In Java

If statements are at the core of any Java program. They allow you to make decisions in your code.


public class Cake {

final static boolean I_HATE_CAKE = false;

public static void main(String[] args) {
// TODO Auto-generated method stub
if (I_HATE_CAKE) {
System.out.println("I really don't like cake. I hate it.");
} else {
System.out.println("I enjoy cake.");
}
}

}

No comments:

Post a Comment

Slump

 I feel like I'm in a slump. I can't even think of what to write about. The cursor just sits there. It's a staring match that wo...