Wap to use Ternary Operator in Java

 import java.util.Scanner;

class Ternary

{

public static void main(String []arg)

{

Scanner scanner = new Scanner(System.in);

int feb;

System.out.print("Enter the no of days in February month:");

feb =scanner.nextInt();

System.out.println((feb==28) ? "The is a Leap Year" : "This is not a Leap Year");

}

}

Comments

Popular posts from this blog

Completed Certification from J.P. Morgan - Software Engineering Job Simulation

Student Registration form using PHP

Create a java Applet program of Calculator