Revision 0b8cef74-4f99-42fb-bafa-3b9ae2e50e71 - Code Golf Stack Exchange
#Java 10, 2 quines, <s>1448</s> 1248 bytes
<!-- language-all: lang-java -->
#<s>1350</s> 1122 bytes
\u0076\u002D\u003E\u007B\u0076\u0061\u0072\u0020\u0072\u003D\u0022\u0076\u002D\u003E\u007B\u0076\u0061\u0072\u0020\u0072\u003D\u0025\u0063\u0025\u0073\u0025\u0031\u0024\u0063\u003B\u0072\u002E\u0066\u006F\u0072\u006D\u0061\u0074\u0028\u0072\u002C\u0033\u0034\u002C\u0072\u002C\u0039\u0032\u0029\u002E\u0063\u0068\u0061\u0072\u0073\u0028\u0029\u002E\u0066\u006F\u0072\u0045\u0061\u0063\u0068\u0028\u0063\u002D\u003E\u0053\u0079\u0073\u0074\u0065\u006D\u002E\u006F\u0075\u0074\u002E\u0070\u0072\u0069\u006E\u0074\u0066\u0028\u0025\u0031\u0024\u0063\u0025\u0063\u0025\u0033\u0024\u0063\u0075\u0025\u0025\u0030\u0034\u0058\u0025\u0031\u0024\u0063\u002C\u0063\u0029\u0029\u003B\u007D\u0022\u003B\u0072\u002E\u0066\u006F\u0072\u006D\u0061\u0074\u0028\u0072\u002C\u0033\u0034\u002C\u0072\u002C\u0039\u0032\u0029\u002E\u0063\u0068\u0061\u0072\u0073\u0028\u0029\u002E\u0066\u006F\u0072\u0045\u0061\u0063\u0068\u0028\u0063\u002D\u003E\u0053\u0079\u0073\u0074\u0065\u006D\u002E\u006F\u0075\u0074\u002E\u0070\u0072\u0069\u006E\u0074\u0066\u0028\u0022\u005C\u005C\u0075\u0025\u0030\u0034\u0058\u0022\u002C\u0063\u0029\u0029\u003B\u007D
[Try it online.](https://tio.run/##7VRNT8MwDL3zK3zsDqCSNGmricu6cWMXJC7AIWQDdZSA1o8L2m8vrRPJhooJCXFDal3Xtd@L/SrvTGdOd5vn3lamruHKlO79BKB0zXb/aOwW1uMrQPdabsBGN@Ojm82H2GG4h6tuTFNaWIODC@jv2jhO9WjFcrRyhZEFxfU5@gJzYvIl5gvxawSFOZL8lPkSa0VCOXLB0JBLe5ZLiusl48VakbGqAnE8WkKRT19ztD6SMy6s0tnXvsKZs0n@5GyJolqO5mvDHNgkFUbSnFh8R1pRp4HLsyjWtdeCzVwjjl4xHM1O/s3Mpxr56fEczyuYlTFNWB3HL5ifkw1asz/tX/0/VB9zVEE2Pa6m@Il2/dzvnbf2oRr2Tlg/uJ5ehuUVXTf70j3d3oOZ@c3lzmzk2qoKS@vQfwA)
Equivalent to:
v->{var r="v->{var r=%c%s%1$c;r.format(r,34,r,92).chars().forEach(c->System.out.printf(%1$c%c%3$cu%%04X%1$c,c));}";r.format(r,34,r,92).chars().forEach(c->System.out.printf("\\u%04X",c));}
**Explanation:**
v->{ // Method with empty unused parameter and no return-type
var r="v->{var r=%c%s%1$c;r.format(r,34,r,92).chars().forEach(c->System.out.printf(%1$c%c%3$cu%%04X%1$c,c));}";
// Unformatted source code
r.format(r,34,r,92) // Formatted quine
.chars() // Loop over the characters as integers
.forEach(c->System.out.printf("\\u%04X",c));}
// Print "\u" with hexadecimal value of these characters
----------
#126 bytes
v->{int i='}'-'[';var s="v->{int i='}'-'[';var s=%c%s%c;System.console().printf(s,i,s,i);}";System.console().printf(s,i,s,i);}
`System.console()` will return `null` when none is provided, so [TIO returns a `NullPointerException` in this case](https://tio.run/##jY9NCoMwEIX3PcUgSBJQLxDsDepG6Ea6SGNaYmMUEwNFPHs6VreFwjyG@XnwvU4EkXftK0ojnIOL0HY5AWjr1fQQUkG1jQBh0C1Iet1aYBx3KwrLeeG1hAoslBBDfl7QC7okK8lJQ3gQE7gy@XVIZepSyeu386ov5GDdYBRlxTjh94O6TGcoxtfkj5/Id6ZxvhtkOtC@6D0Go7VHx7O5gWB7KltIamdjjkBr/AA).
To prove it's a working quine, replace `System.console()` with `System.out`: [Try it online.](https://tio.run/##fY9NCoMwEIX3PcUgSCKoFwj2BnUjdCNdTKMtsRrFxECRnD0dq9sW5jHMz4Pvdegw65pXkD0aAxdUej0BKG3b@YGyhXIbAdyoGpD8ujWXCNp5EpWxaJWEEjQUEFx2XskLqmCeZaxmwuEMpoh@HWIZm1iK6m1sO@TjYvNppr8HN6lKSYnw0d9rEDvHtNx74jhwvrgDheGVJcezvgEmexKdS66Xvj9C@PAB)
**Explanation:**
v->{ // Method with empty unused parameter and no return-type
int i='}'-'['; // Integer `i` = 34 (unicode value for double-quote)
var s="v->{int i='}'-'[';var s=%c%s%c;System.console().printf(s,i,s,i);}";
// Unformatted source code
System.console().printf(s,i,s,i);}
// Print formatted quine
----------
**General explanation:**
In Java a [tag:quine] is usually done like this:
- The `String s` contains the unformatted source code.
- `%s` is used to input this String into itself with the `s.format(...)`.
- `%c`, `%1$c` and the `34` are used to format the double-quotes.
- `s.format(s,34,s)` puts it all together.
In which case the shortest quine lambda-function in Java 10 would be this (**82 bytes**):
v->{var s="v->{var s=%c%s%1$c;return s.format(s,34,s);}";return s.format(s,34,s);}
[Try it online.](https://tio.run/##dY7BCoJAEIbvPcUgCSuoEHUTe4O8BF2iw7RqrK2r7IwLIT67rSh0CmZg/vkP39egw6Qp37PUSAQXVGbcASjDla1RVlAsEeDKVpkXSHHrVAkuyvx38uuHGFlJKMBADrNLzqNDC5QHvzOUIYWHvcxsxYM1QGnd2RZZUHw8xRRlU/C/mrOV0w9P7Tkbzi0erdcVq9r9ARhtrh/iqk27gdPeVyxMKoUZtI427Wn@Ag)
Since the only way to have two quines in Java is using the unicode version with `\uHEXA`, which is converted to characters during compilation, I'm unable to use the characters `0123456789ABCDEF\u` in the non-unicode version. So, the smaller non-unicode version will use `System.console()` instead of `return` or `System.out` (both containing a 'u'), and will use `'}'-'['` and two times `%c` instead of `34` and `%1$c`.
Some things to note about the unicode version:
- I'm on purpose using `%04X` instead of `%04x` (for uppercase Hexadecimal instead of lowercase).
- I'm using `92`, `%c` and `%3$c` to format the slashes.
- Using a capital `\U` instead of lowercase `\u` isn't allowed apparently, otherwise I would have just used `return` in the shorter non-unicode version.