Created
October 7, 2013 10:13
-
-
Save siguremon/6865532 to your computer and use it in GitHub Desktop.
JavaToGroovy
This file contains hidden or 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
class HelloWorld { | |
private String name | |
void setName(String name) { | |
this.name = name | |
} | |
String getName() { | |
return name | |
} | |
String greet() { | |
return "Hello " + name | |
} | |
static void main(String[] args) { | |
HelloWorld helloWorld = new HelloWorld() | |
helloWorld.setName("Groovy") | |
System.out.println( helloWorld.greet() ) | |
} | |
} |
This file contains hidden or 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 HelloWorld { | |
private String name; | |
public void setName(String name) { | |
this.name = name; | |
} | |
public String getName() { | |
return name; | |
} | |
public String greet() { | |
return "Hello " + name; | |
} | |
public static void main(String[] args) { | |
HelloWorld helloWorld = new HelloWorld(); | |
helloWorld.setName("Groovy"); | |
System.out.println( helloWorld.greet() ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment