Created
June 12, 2014 16:37
-
-
Save meyerzinn/9278c79ee49c3d641368 to your computer and use it in GitHub Desktop.
Message
This file contains hidden or 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 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