Home > Java > javaTutorial > How to compare data in java

How to compare data in java

王林
Release: 2023-05-10 10:43:16
forward
1798 people have browsed it

Explanation

1. Compare basic type ==. It is recommended to compare equals or compareTo for the comparison object value.

First of all, data in Java is stored in the JVM, and basic type data is stored in the local variable table of the JVM, which can also be understood as the so-called "stack".

2. You can use == to compare whether the values ​​of type int are equal, but please note that int and Integer are completely different. One is a basic type and the other is an object.

Examples

Compare basic type values

int i = 11111111;
int j = 11111111;
System.out.println(i == j);
Copy after login

What collection classes are there in Java

Collections in Java are mainly divided into four categories :

1. List: ordered and repeatable;

2. Queue: ordered and repeatable;

3. Set: not possible Repeat;

4. Map mapping: unordered, unique keys and non-unique values.

The above is the detailed content of How to compare data in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
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
Latest Issues
Install JAVA
From 1970-01-01 08:00:00
0
0
0
Unable to install java
From 1970-01-01 08:00:00
0
0
0
Can java be used as the backend of the web?
From 1970-01-01 08:00:00
0
0
0
Is this in Java language?
From 1970-01-01 08:00:00
0
0
0
Help: JAVA encrypted data PHP decryption
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template