Java의 String에 대한 논리 연산자를 구현해 보겠습니다. -
예
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라는 클래스에는 4개의 변수가 선언된 메인 함수가 포함되어 있으며 이러한 변수를 사용하여 다양한 논리 연산자를 구현하고 콘솔에서 선언합니다.