Write a Program the Use of Simple If Else in Java Programming Language.
public class Simple_if_else { public static void main(String[] args) { // change the value of String "Green" to "Red" and see Message Will be change. String trafficSignal = "Green"; if (trafficSignal == "Red") { System.out.println("Stop"); } else { System.out.println("Go..."); } } }
Output:
(Visited 88 times, 1 visits today)
Written by: