Do you know Java: I Need Dollars, Dollars, ...


Some special characters are accepted as part of an identifier, dollar sign is among them.

Have you ever though about to write an application, whichever small that would be, and use as less identifier as possible.

And what if the identifier is weird itself already?

class $ {
    private String $;
    
    public void $(String $) {
        this.$ = $;
    }
    
    public String $() {
        return this.$;
    }
}

public class Main {
    public static void main(String[] args) {
        $ $ = new $();
        $.$("$");
        System.out.println($.$());
    }
}

_ works similar in pre Java 9 versions, and __ works similar in Java 9 and onwards.

$ character is used as an identifier as many place as it is possible.

Code can be found: https://github.com/torokmark/do-you-know-java