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