Skip to content

Instantly share code, notes, and snippets.

@meyerzinn
Created June 12, 2014 16:37
Show Gist options
  • Save meyerzinn/9278c79ee49c3d641368 to your computer and use it in GitHub Desktop.
Save meyerzinn/9278c79ee49c3d641368 to your computer and use it in GitHub Desktop.
Message
package inheritance;
public class Message {
// Private variables cannot be inherited into subclasses.
// Protected variabes can be inherited in the subclass.
protected long timestamp;
protected long maxSize;
// This method sets or assigns the argument time to the class variable
// timestamp.
public void setTimestamp(long time) {
timestamp = time;
}
public long getTimestamp() {
return timestamp;
}
// This method sets or assigns the argument max to the class variable
// maxSize.
public void setMaxSize(long max) {
maxSize = max;
}
public long getMaxsize() {
return maxSize;
}
public void printMessage() {
System.out.println("Message Timestamp: " + timestamp);
System.out.println("Message MaxSize: " + maxSize);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment