Created
April 13, 2014 07:33
-
-
Save wingyplus/10573289 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 main | |
import "fmt" | |
type User struct { | |
Username string | |
} | |
func (u User) String() string { | |
return u.Username | |
} | |
func main() { | |
var win User = User{Username: "Thanabodee"} | |
fmt.Println("Hello, playground", win) | |
} |
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 User implements Stringer { | |
private String username; | |
User(String username) { | |
this.username = username; | |
} | |
@Override | |
public String String() { | |
return username; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment