Java Reference
In-Depth Information
Code 8.2
continued
Source code of the
PhotoPost
class
public
void
addComment(String text)
{
comments.add(text);
}
/**
* Return the filename of the image in this post.
*
* @return The post's image filename.
*/
public
String getImageFile()
{
return
filename;
}
/**
* Return the caption of the image of this post.
*
* @return The image's caption.
*/
public
String getCaption()
{
return
caption;
}
/**
* Return the time of creation of this post.
*
* @return The post's creation time, as a system time value.
*/
public
long
getTimeStamp()
{
return
timestamp;
}
/**
* Display the details of this post.
*
* (Currently: Print to the text terminal. This is simulating
* display in a web browser for now.)
*/
public
void
display()
{
System.out.println(username);
System.out.println(
" ["
+ filename +
"]"
);
System.out.println(
" "
+ caption);
System.out.print(timeString(timestamp));
Search WWH ::
Custom Search