Created
June 22, 2012 13:59
-
-
Save meza/2972883 to your computer and use it in GitHub Desktop.
Greeter
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 Greeter { | |
public String greetMessage(User user) { | |
return "Hi, "+user.email(); | |
} | |
} |
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 GreetPrinter { | |
public void static main(String[] args) { | |
if (args.length < 1) { | |
throw new RuntimeException("No email"); | |
} | |
User user = new User(args[0]); | |
Greeter greeter = new Greeter(); | |
System.out.println(greeter.greetMessage(user)); | |
} | |
} |
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 User { | |
private String email = ""; | |
public User(String email) { | |
this.email = email; | |
} | |
public String email() { | |
return email; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment