Home  >  Article  >  Java  >  What does == symbol mean in java

What does == symbol mean in java

尚
Original
2019-11-30 10:47:2717039browse

What does == symbol mean in java

"==" in Java is a relational operator, which checks whether the values ​​of the two operands are equal. If they are equal, the condition is true. (Recommended: java video tutorial)

1. For basic data types, == indicates whether the values ​​are equal,

For example:

int x = 3;
if(x==3){//true
//do something  
}

2. For object data types, == indicates whether the address values ​​​​are equal.

For example:

String str1 = new String("str1");
String str2 = new String("str2");
if(str1 ==str2){//false
//do something
}

For more java knowledge, please pay attention to the java basic tutorial column.

The above is the detailed content of What does == symbol mean in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn