Logical operation of Java Foundation

Source: Internet
Author: User

http://www.verejava.com/?id=16992598459515

public class operation4{public static void Main (string[] args) {//Logical Operations/* Includes: With && (and), or | |             (OR) Not! 1. && returns the result to True when both sides of the operation are true, otherwise false 2. ||             Returns false if both sides of the operation are false, otherwise true; 3.!        Inverse, the operation is true to return the result false, otherwise true */System.out.println (true&&false);        System.out.println (false&&true);        System.out.println (False&&false);        System.out.println (true&&true);        System.out.println ("---------------"); System.out.println (true| |        FALSE); System.out.println (false| |        true); System.out.println (true| |        true); System.out.println (false| |        FALSE);        System.out.println ("---------------");        System.out.println (!true);        System.out.println (!false); !        is the monocular operation//system.out.println (True!false);        System.out.println ("----------------");        Boolean b=true;        System.out.println (b); System. Out.println (1>2&& (b=3>4));        System.out.println (b);        System.out.println (2>1&& (b=3>4));        System.out.println (b); */* NOTE: && short-circuit characteristics: Because the program is from the top down, from left to right, when judging the left is false when the return of && is doomed to be false, so the subsequent judgment of the computer        Will not be carried out.        */System.out.println ("--------------");        Boolean b1=true;        System.out.println (B1); System.out.println (2>1| |        3>4); System.out.println (2>1| |        (b1=3>4));        System.out.println (B1); System.out.println (1>2| |        (b1=3>4));        System.out.println (B1); /* Note: | | Short-circuit Characteristics: Because the program is executed from left to right, when judging the left is true the return result is doomed to be true, so the subsequent judgment computer does not execute */}}

http://www.verejava.com/?id=16992598459515

Logical operation of Java Foundation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.