Wednesday 28 October 2015

Java Tutorial : Java Conditional-Or Operator


Click here to watch in Youtube :
https://www.youtube.com/watch?v=eGEQxhe4OB0&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java Conditional-Or Operator 
Java Tutorial : Java Conditional-Or Operator 

ConditionalOrOperatorDemo.java
class ConditionalOrOperatorDemo
{
    public static void main(String[] args)
    {
        int value1 = 1;
        int value2 = 2;

        /*
         * true || true is true
         * 
         * 1 || 1 is 1
         */
        
        boolean value = (value1 == 1) || (value2 == 2);
        System.out.println(value);

        /*
         * true || false is true
         * 
         * 1 || 0 is 1
         */
        
        value = (value1 == 1) || (value2 == 90);
        
        System.out.println(value);

        /*
         * false || true is true
         * 
         * 0 || 1 is 1
         */
        value = (value1 == 20) || (value2 == 2);
        System.out.println(value);

        /*
         * false || false is false
         * 
         * 0 || 0 is 0
         */
        value = (value1 == 100) || (value2 == 90);
        System.out.println(value);

    }
}
Output
true
true
true
false
To Download OperatorsDemoConditional-Or-App Project Click the below link
https://sites.google.com/site/javaee4321/java/OperatorsDemoConditional-Or-App.zip?attredirects=0&d=1

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment