Skip to content

Instantly share code, notes, and snippets.

@meyerzinn
Created June 12, 2014 16:37
Show Gist options
  • Save meyerzinn/3bb2ba9736b63570ace6 to your computer and use it in GitHub Desktop.
Save meyerzinn/3bb2ba9736b63570ace6 to your computer and use it in GitHub Desktop.
OverridingTest
package inheritance;
public class OverridingTest {
public static void main(String[] args) {
Message message = new Message();
message.setMaxSize(1000);
message.setTimestamp(System.currentTimeMillis());
message.printMessage();
TextMessage textMessage = new TextMessage();
textMessage.setMaxSize(10000);
textMessage.setTimestamp(System.currentTimeMillis());
textMessage.setText("This is a message.");
textMessage.printMessage();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment