5.3 How to use Ternary Operator in Java Tutorial

///5.3 How to use Ternary Operator in Java Tutorial

5.3 How to use Ternary Operator in Java Tutorial

FavoriteLoadingAdd to favorites

Suppose I declare two variable i=1,j=5 and if i==1 then print j=6 then I instead of using if else we use j=i==1?6:7.You can replace your if else with ternary. Ternary operator is to assign the minimum (or maximum) value of two variables to a third variable.

Java468x60

Check out our website:

Follow Telusko on Twitter:

Follow on Facebook:
Telusko :
Navin Reddy :

Follow Navin Reddy on Instagram:

Subscribe to our other channel:
Navin Reddy :
Telusko Hindi :

Subscribe to the channel and learn Programming in easy way.

Java Tutorial for Beginners:

C Tutorial Playlist :

Android Tutorial for Beginners Playlist :

XML Tutorial :

Design Patterns in Java :

Socket Programming in Java :

Spring MVC Tutorial :

OpenShift Tutorial for Beginners :

Spring Framework with Maven :

Sql Tutorial for Beginners :

String Handling in Java :

Array in Java :

Java Servlet :

Exception Handling in Java :

source

By |2020-05-23T03:37:10+00:00May 23rd, 2020|Java Video Tutorials|29 Comments

29 Comments

  1. The bunny Rabbit May 23, 2020 at 3:37 am - Reply

    Thoda awaaz lao mooh me

  2. komal patil May 23, 2020 at 3:37 am - Reply

    Great sir.. thank you

  3. nama sreerama May 23, 2020 at 3:37 am - Reply

    Sir voice is slow so speak highly

  4. what is the object in this video? Is it is an inbuilt class or derived datatype and what is the use of it. Can anyone help me

  5. NEEHARIKA PATEL May 23, 2020 at 3:37 am - Reply

    What is 'object' in this video??? Is it data type??

  6. thiagarajan selvaraj May 23, 2020 at 3:37 am - Reply

    Sir, in this video ,sound is not audible. And this problem is occuring in some of the other videos also.Kindly do the needful

  7. Akash Singh May 23, 2020 at 3:37 am - Reply

    i used float instead of double then too it showed 10.0 as output…..Why?
    dont they take same space.

  8. Antara Saha May 23, 2020 at 3:37 am - Reply

    Why don't you improve the sound quality? sometimes it feels like you are shouting and the next moment nothing is audible.

  9. Aryan Ambastha May 23, 2020 at 3:37 am - Reply

    low volume sir!!!

  10. Smruti Dash May 23, 2020 at 3:37 am - Reply

    Good One ,all your explanation is from basic.

  11. Lekshmi R S May 23, 2020 at 3:37 am - Reply

    low volume.. difficult to understand what you speak. 🙁

  12. Shamim Jobayer May 23, 2020 at 3:37 am - Reply

    Great tutorial, clearly explained!

  13. Rakesh Bongi May 23, 2020 at 3:37 am - Reply

    object?

  14. Nikhil Raj May 23, 2020 at 3:37 am - Reply

    On compiling, I'm getting this message:
    F:BeginsJAVAIntelliJControlStatementsAndArrays>javac IfElseVSTernOp.java

    Note: IfElseVSTernOp.java uses or overrides a deprecated API.

    Note: Recompile with -Xlint:deprecation for details.

    What is "-Xlint" ?

  15. Salman Abbas May 23, 2020 at 3:37 am - Reply

    sir i have a doubt, what condition have you taken to be true in if(true) condition plz explain

  16. Siddharth Prasad May 23, 2020 at 3:37 am - Reply

    Is it necessary to write package com.navin ; in this coding

  17. Smart Programming May 23, 2020 at 3:37 am - Reply

    nice one sir, thanks for this sir 🙂

  18. Austin McDaniel May 23, 2020 at 3:37 am - Reply

    You sound like you're eating a bowl of soup

  19. HARSH KUMAR May 23, 2020 at 3:37 am - Reply

    volume is not good !!

  20. Israel Alakpa May 23, 2020 at 3:37 am - Reply

    U jus jumped to object like that? I give u a dislike for this vry video

  21. Vicky Kandhagatla May 23, 2020 at 3:37 am - Reply

    poor voice clarity

  22. asim shahzad May 23, 2020 at 3:37 am - Reply

    and if value in the right is smaller then what ???
    e.g .
    true?new Integer(10):new Double(5.0);

    in my case it also gives 10.0 although 5.0 is smaller than 10 but it is selecting the data type of minimume number i.e 5.0

  23. Sourabh Kumar Singh May 23, 2020 at 3:37 am - Reply

    sir speak loudly

  24. Fathiya Adel May 23, 2020 at 3:37 am - Reply

    amazing video

  25. Ramesh Gaming May 23, 2020 at 3:37 am - Reply

    hey be clear.you are not audible properly.

  26. Aidan DiPeri Danielski May 23, 2020 at 3:37 am - Reply

    Favoring Double over Integer is stupid.

  27. shruti sharma May 23, 2020 at 3:37 am - Reply

    Volume is too low.

  28. Ashish Meshram May 23, 2020 at 3:37 am - Reply

    class MyClass
    {
    public static void main(String args[])
    {
    {
    int x = 5;
    if (x < 1);
    System.out.println("Hello");
    }
    }
    }

    in the program above the output is Hello. I don't understand why?

  29. ________________ May 23, 2020 at 3:37 am - Reply

    Currently using your videos to read code and figure out ways to create plugins for a custom programmed MC server I wanna make. Your videos are clear, short, and easy to understand. +1 like for each video and +1 sub for you. 🙂

Leave A Comment

*