Created
January 12, 2012 15:25
-
-
Save Mongey/1601104 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
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; | |
} | |
} |
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 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