Friday, 30 December 2016

Ternary Operator In Java Example

package com.kt4study.corejava.operators;

/**
 @author kt4study.blogspot.co.uk
 
 */

public class TernaryOperatorExample {
  
  public static void ternaryOperator(){
    int a = 10;
    int b = 5;
    int result;
    
    // ?: Ternary Operator Example
    result = ((a+b== 151000 2000 ;
    System.out.println("Result  :: " + result);
    
  }

  public static void main(String[] args) {
    TernaryOperatorExample.ternaryOperator()
  }
}

/*Output -->
Result  :: 1000
*/
Output →

Result :: 1000

No comments:

Post a Comment