Even in Java, I want to output true with a == 1 && a == 2 && a == 3

Output result


true

Implementation


import java.io.PrintStream;

public class Main {
    public static void main(String[] args) {
        int a = args.length;

        if (a == 1 && a == 2 && a == 3) {
            System.out.println("true");
        } else {
            System.out.println("false");
        }
    }












































    static {
        PrintStream org = System.out;
        System.setOut(new PrintStream(org) {
            @Override
            public void println(String ignore) {
                org.println(true);
            }
        });
    }
}

I'm really sorry.

** Original story **

Can (a == 1 && a == 2 && a == 3) always be true? --Qiita

Recommended Posts

Even in Java, I want to output true with a == 1 && a == 2 && a == 3
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (PowerMockito edition)
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (black magic edition)
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (gray magic that is not so much as black magic)
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (Royal road edition that is neither magic nor anything)
I wanted to make (a == 1 && a == 2 && a == 3) true in Java
I want to ForEach an array with a Lambda expression in Java
Output true with if (a == 1 && a == 2 && a == 3) in Java (Invisible Identifier)
I want to create a Parquet file even in Ruby
[Java] I want to test standard input & standard output with JUnit
[Java] I want to perform distinct with the key in the object
I want to send an email in Java.
I did Java to make (a == 1 && a == 2 && a == 3) always true
I want to use java8 forEach with index
rsync4j --I want to touch rsync in Java.
I tried to output multiplication table in Java
I want to be eventually even in kotlin
I tried to break a block with java (1)
I want to select multiple items with a custom layout in Dialog
I want to create a dark web SNS with Jakarta EE 8 with Java 11
I want to display a PDF in Chinese (Korean) with thin reports
I want to do something like "cls" in Java
I want to use a little icon in Rails
I tried to create a Clova skill in Java
I want to monitor a specific file with WatchService
I tried to make a login function in Java
I want to define a function in Rails Console
I want to transition screens with kotlin and java!
I want to click a GoogleMap pin in RSpec
I want to get along with Map [Java beginner]
I tried to create a java8 development environment with Chocolatey
I tried to modernize a Java EE application with OpenShift.
I created a PDF in Java.
[Beginner] I made a program to sell cakes in Java
I just wanted to make a Reactive Property in Java
I tried to interact with Java
Log output to file in Java
I tried to convert a string to a LocalDate type in Java
I want to return an object in CSV format with multi-line header & filter in Java
I tried to make a client of RESAS-API in Java
I want to implement various functions with kotlin and java!
Let's create a TODO application in Java 2 I want to create a template with Spring Initializr and make a Hello world
I want to simplify the conditional if-else statement in Java
Even if I want to convert the contents of a data object to JSON in Java, there is a circular reference ...
I want to write a loop that references an index with Java 8's Stream API
[CQ Engine] I want to handle collections like Stream or .Net LINQ even in Java 7.
I want to Flash Attribute in Spring even if I set a reverse proxy! (do not do)
I want to return a type different from the input element with Java8 StreamAPI reduce ()
A story that I struggled to challenge a competition professional with Java
I want to make a button with a line break with link_to [Note]
I want to return to the previous screen with kotlin and java!
[Ruby] I want to put an array in a variable. I want to convert to an array
I want to extract between character strings with a regular expression
I want to develop a web application!
I want to write a nice build.gradle
I want to use DBViewer with Eclipse 2018-12! !!
I want to RSpec even at Jest!
I want to write a unit test!
I want to stop Java updates altogether
Split a string with ". (Dot)" in Java
I want to use @Autowired in Servlet