Skip to content

Instantly share code, notes, and snippets.

@Mongey
Created January 12, 2012 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mongey/1601104 to your computer and use it in GitHub Desktop.
Save Mongey/1601104 to your computer and use it in GitHub Desktop.
public class Message{
public String recipient, sender,body;
public Message(String recipient, String sender,String body){
this.recipient=recipient;
this.sender=sender;
this.body = body;
}
public void append(String text){
this.body = this.body + text;
}
public String toString(){
return "Sender :" + this.sender + ".\nReciever :" + this.recipient +"\n" + "Message Body:\n" + this.body;
}
}
public class Program {
public static void main(String[] args) {
Message test = new Message("mongeyc@tcd.ie", "test@test.com","This should");
test.append(" hopefully work!");
System.out.print(test);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment