❮ Previous Next ❯

Java Logical Operators:

Java provides three logical operators such as :

The logical operators && and || are used when we want to form compound conditions by combining two or more relations. For example:

X<y && x+y>y

Here this expression contains two expressions combined by && operator.

Let's see a program :

class LogicalDemo
{
public static void main(String args[])
{
int x=10,y=15;
boolean p;
boolean q;
p=(x<y)&&((x+y)>x);
q=(x>=y)||((x+y)<x);
System.out.println(p);
System.out.println(q);
}
}
Output:

true
false

❮ Previous Next ❯

Follow Us




  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved