cool hit counter javain& harmony&& distinctions and linkages_Intefrankly

javain& harmony&& distinctions and linkages


I think many people are learning java, or other languages (e.g. C#, . Net, etc.) are encountered

&harmony&&

However, if you don't really understand what they mean, this can cause a lot of trouble in your thinking above

In this blog, when you read through it, you'll see that it's easy to tell them apart

Here is my demo

 1 /**
 2  * 
 3  */
 4 package com.b510.test;
 5 
 6 /**
 7  * @author Jone Hongten
 8  * @create date:2013-11-2
 9  * @version 1.0
10  */
11 public class Test {
12 
13     public static void main(String[] args) {
14         String str = null;
15         if(str != null && !"".equals(str)){
16             //do something
17         }
18         if(str != null & !"".equals(str)){
19             //do something
20         }
21     }
22 }

We may have some ambiguity now, Now let's take a look.&harmony&& The circuit problems of the:

as far as sth is concerned:&&

if(str != null && !"".equals(str))

proper: str != null at the time of, It's the next step to execute: !"".equals(str)

in case: str != null because offalse, So this time., The program is in a short-circuit situation, follow,!"".equals(str) It's not gonna work.。

But for: &

if(str != null & !"".equals(str))

regardless of: str != null What is the outcome of the( i.e.true,false), The programs will all execute: !"".equal(str)

Summary of circuit problems.

as far as sth is concerned:& -- > however, All will be implemented"&" The procedure for the left and right side of the symbol

as far as sth is concerned:&& -- > Only if the symbol"&&" The left program is true(true) back, Only then will the symbol be executed"&&" The procedure on the right。

Here are the rules of arithmetic.

as far as sth is concerned:& -- > As long as one of the left and right sides is forfalse, standardfalse; Only all of them are fortrue at the time of, end up withtrue

as far as sth is concerned:&& -- > As long as the left side of the symbol isfalse, Then the result isfalse; When the left side istrue, Also on the right is thetrue, Then the result istrue

E | hongtenzone@foxmail.com B |http://www.cnblogs.com/hongten


Recommended>>
1、Gosikian Why do some people fear blockchain Because their authority is gone
2、Thousand Krypton Finance BTC123 The Present and the Future
3、Anhui Weimai was recognized as a big data enterprise in Hefei
4、Jedi Officially all custom servers will be confiscated Someone did something just as disgusting as turning on the heat
5、5 Pillars of a Successful Automation Test Implementation

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号