Thursday, February 12, 2015

Ternary Operator

Ternary operations contains a condition and execute the true or false apart accordingly it also possible to assign it to a variable.


package Example1;

public class TernaryOperator {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int x=10;
		int y=20;
		String result=(x
output:
x is less than y
>>>Switch
------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment