Java 中的字符串逻辑运算符
让我们在 Java 中实现字符串上的逻辑运算符 -
示例
import java.io.*;
public class Demo{
public static void main(String[] args){
int a = 45, b = 32, c = 87, d = 1;
System.out.println("The first variable is " + a);
System.out.println("The second variable is = " + b);
System.out.println("The third variable is = " + c);
if ((a > b) && (b == c)){
d = a + b + c;
System.out.println("The sum is " + d);
}
else
System.out.println("The conditions haven't been fulfilled");
}
}产出
The first variable is 45 The second variable is = 32 The third variable is = 87 The conditions haven't been fulfilled
一个名为 Demo 的类包含 main 函数,其中声明了 4 个变量,并使用这些变量实现了各种逻辑运算符,并在控制台上对其进行声明。
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP