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

Ever feel like no one is listening?

 Ever have that feeling that no one is listening to you? Yeah, that feeling. It can be a strong feeling to have, a hurtful feeling also. The...