Skip to content

Instantly share code, notes, and snippets.

@whileD
Created September 18, 2016 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whileD/a3eeb1144c57c525828558713ef04f35 to your computer and use it in GitHub Desktop.
Save whileD/a3eeb1144c57c525828558713ef04f35 to your computer and use it in GitHub Desktop.
gomi code
public class Gomi{
//print hello world
public static void main(String[] args){
class Hello{
public char[] helloworld = new char[10];
{
helloworld[0] = 'H';
helloworld[1] = 'e';
helloworld[2] = 'l';
helloworld[3] = 'l';
helloworld[4] = 'o';
for(int i = 5; i < helloworld.length; i++){
helloworld[i] = '0';
}
}
public void setChar(int num, char ch){
helloworld[num] = ch;
}
public void setChar(){
setChar(5, 'W');
setChar(6, 'o');
setChar(7, 'r');
setChar(8, 'l');
setChar(9, 'd');
}
public char[] getHello(){
return helloworld;
}
}
System.out.println(
helloWorld(new Object(){
public String toString(){
String helloWorld = "";
Hello hello = new Hello();
hello.setChar();
char[] tmpHello = hello.getHello();
for(int i = 0; i< tmpHello.length; i++){
helloWorld += String.valueOf(tmpHello[i]);
}
return helloWorld;
}
}));
}
public static String helloWorld(Object o){
return o.toString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment