Created
September 18, 2016 12:52
-
-
Save whileD/a3eeb1144c57c525828558713ef04f35 to your computer and use it in GitHub Desktop.
gomi code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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