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

Wap to Use Increment And Decrement Operator In Java

Q. Wap to sort an array using Bubble Sort

WAP to use Assignment Operator in Java