Saturday, 28 November 2015

And Or in Java

package day1.examples;

public class ExampleAndOr {

            public static void main(String[] args) {

                        int x, y;
                        x = 10;
                        y = -10;
                        // && And
                        // || Or

                        if (x > 0 && y > 0) {

                                    System.out.println("Both Numbers are Positive");
                        } else if (x > 0 || y > 0) {

                                    System.out.println("Atleast One number is Positive");

                                    System.out.println("          -- By Lokanadham Thandlam");
                        }

            }

}