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