In Java, I verified which alphabet can be written by prohibiting one alphabet (writing without using one of a to z). Just play.
1.java10,Windows10 2. Compile with javac, execute with java, no options (or rather write in Eclipse and execute) 3. Output Hello, world! To standard output 4. No extra standard output or error output (line breaks are OK) 5. Prohibition of using only one type of alphabet 6. Case insensitive 7. Prohibit external files (only Java standard library is possible) 8. Unicode escape prohibited (2018-08-26 postscript) * Details will be described later
Possible: bfhjklpquwxyz Impossible: acdegimnorstv
I'm writing a code that is roughly tied in alphabetical order. fjkqxz It doesn't appear in the Hello World I wrote normally. By the way, variable names and class names are in Japanese so as not to use alphabets. I wonder if there are people who use the fact that the class name can use anything other than the alphabet ... (I saw it once used in educational source code.)
Hello World.java
class Hello World{
public static void main(String[]argument) {
System.out.print("Hello, World!");
}
}
b Since public is implicitly added to the method in interface, there is no need to write it in the main statement. I think it was a function from java7 or 8. However, since there are many characters used elsewhere, only b can be dealt with.
Hello World.java
interface Hello World{
static void main(String[]argument) {
System.out.print("Hello, World!");
}
}
hlpw Enter the character code in the format format so that the character string contained only in Hello, world is not used. By using format instead of printf, we avoid using p, and by using interface, we avoid using pl in public.
Hello World.java
interface Hello World{
static void main(String[]argument) {
System.out.format("%c%c%c%c%c, %c%c%c%c%c!",72,101,108,108,111,87,111,114,108,100);
}
}
uy Since it is in s [y] stem.o [u] t, I somehow do standard output without using it. There is a class that can execute a script language called ScriptEngine, and when you output with a script, it is output as standard. However, since the getB [y] Name method is used when getting the ScriptEngine, execute this from the character string using getClass, getMethod, invoke, and in the character string, get y from the number and solve it.
Hello World.java
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
interface Hello World{
static void main(String[]argument) throws Exception {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = (ScriptEngine)manager.getClass()
.getMethod("getEngineB"+(char)121+"Name", String.class).invoke(manager, "javascript");
String script = "print('Hello, World!')";
engine.eval(script);
}
}
acdgimnorstv Since static void main (String [] argument) is absolutely necessary, the alphabet contained in it cannot be omitted. Without this, it cannot be executed in the first place. Is there a way to deal with this? (2018-08-26 postscript) I got the information that if you inherit JavaFX Application, you do not have to write the main statement.
Hello World.java
public class hello world extends javafx.application.Application{
public void start(javafx.stage.Stage Stage){
System.out.print("Hello, World!");
}
}
However, even with this, most of the characters were used and none of the bindings were resolved. You can use m with Syste [m] .out, but you can't use ScriptEngine [M] analger, and you can't use [m] ethod and na [m] e, so you can't leave it to reflection.
e Like uy, it is in Syst [e] m.out, so it would be nice if it could be output without using this, but it is in Script [E] ngin [e], and even if you try to get it from a string, in the first place It is in g [e] tClass. Or rather, since it is in g [e] t, the method to get something cannot be used. Even if it isn't, the alphabet is fairly easy to use, so it's easy to get caught.
From the above Possible: bfhjklpquwxyz Impossible: acdegimnorstv Will be. The main statement is too disturbing. There seems to be a way to solve e somehow ... Please let me know if there is a way to do it. It might be interesting to do something around fizzbuzz.
Comment for information. In Java, you can write the source code in Unicode escape (\ uxxxx) format. If you use this, theoretically only abcdefu that combines hexadecimal numbers a ~ f and u will come out, and even if a ~ f is converted to Unicode escape, each does not include alphabets, so convert only each alphabet to Unicode escape. Will be resolved. Other than u, it is possible to bind regardless of the code. If that is the case, I don't think it makes much sense to tie it up, so I ban it from my own tying up. It's interesting to see information that you wouldn't use in a normal program if you do something strange like this.
Recommended Posts