Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the Java relational operators

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what are the Java relational operators". In the daily operation, I believe many people have doubts about the Java relational operators. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what are the Java relational operators?" Next, please follow the editor to study!

Operator: forms the basic building block of any programming language. Java also provides many types of operators that you can use to perform various calculations and functions, including logic, arithmetic, relationships, and so on, as needed. They are classified according to the functions they provide.

1. Operator 4: less than operator (= var2

Examples:

Var1 = 20 var2 = 20 var3 = 10 var1 > = var2 result is true var2 > = var3 result is true

Example:

Import java.io.*;class GFG {/ / main method public static void main (String [] args) {/ / initialization variables int var1 = 20, var2 = 20, var3 = 10; / / display var1, var2, var3 System.out.println ("Var1 =" + var1); System.out.println ("Var2 =" + var2); System.out.println ("Var3 =" + var3) / / compare var1 and var2 and print the corresponding Boolean System.out.println ("var1 > = var2:" + (var1 > = var2)); / / compare var2 and var3 and print the corresponding Boolean System.out.println ("var2 > = var3:" (var3 > = var1));}}

Output:

Var1 = 20

Var2 = 20

Var3 = 10

Var1 > = var2: true

Var2 > = var3: false

3. Operator 6: less than or equal to (

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report