Created
October 7, 2014 11:32
-
-
Save jamescrosswell/046b84d86cc698cd3ac5 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 myApp | |
object MyApp { | |
def main(args: Array[String]): Unit = { | |
val greeter = new Greeter() | |
greeter.Greet | |
} | |
} | |
class Greeter(name: String){ | |
require(name != null && !name.isEmpty, "You gotta say hi to someone!") | |
def this() = { | |
this("world") | |
println("Warning: you're addressing the room!") | |
} | |
def Greet() = { println("Hello %s".format(name)) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment