English, asked by karishma9911, 8 months ago

Explain:

Conditional Operator ( ?: ) along with its syntax.

Also write a pogram to find the larger of two variables using the conditional operator.

_!_!_!_ NO SPAM _!_!_!_

COPIED ANSWERS SHALL BE REPORTED!

Answers

Answered by Anonymous
58

ANSWER :

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

CONDITIONAL OPERATOR (?:)

The conditional operator is also called a ternary operator because it has three operands.

Its syntax is :

boolean-expression ? expression1 : expression2

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Question :

Write a program to find the larger of two variables using the conditional operator.

Answer :

public class FindMax

{

public static void main( String args [ ] )

{

int a = 7, b = 13 ;

int max ;

max = ( a > b ) ? a : b ;

System.out.println ("Max number is: " + max) ;

}

}

!HOPE IT HELPS UH!

Similar questions