Last active
August 29, 2015 13:57
-
-
Save Nkzn/9560612 to your computer and use it in GitHub Desktop.
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
package info.nkzn.sample.hogehoge; | |
public class Greeter { | |
private String word; | |
public Greeter(String word) { | |
this.word = word; | |
} | |
public void sayFor(String name) { | |
System.out.println( | |
String.format("%s, %s", word, name)); | |
} | |
public String getWord() { | |
return word; | |
} | |
public void setWord(String word) { | |
this.word = word; | |
} | |
public static void main(String[] args) { | |
Greeter helloGreeter = new Greeter("Hello"); | |
helloGreeter.sayFor("Nkzn"); | |
Greeter goodMorningGreeter = | |
new Greeter("Good morning"); | |
goodMorningGreeter.sayFor("NPoi"); | |
} | |
} |
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
package info.nkzn.sample.hogehoge | |
public class Greeter(val word: String) { | |
val sayFor = { | |
(name : String) -> | |
println("$word, $name!") | |
} | |
} | |
fun main(args : Array<String>) { | |
val helloGreeter = Greeter("Hello") | |
helloGreeter.sayFor("Nkzn") | |
val goodMorningGreeter = | |
Greeter("Good morning") | |
goodMorningGreeter.sayFor("NPoi") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment