printing in the same line in java.
Posted
by sil3nt
on Stack Overflow
See other posts from Stack Overflow
or by sil3nt
Published on 2010-05-31T05:59:31Z
Indexed on
2010/05/31
6:02 UTC
Read the original article
Hit count: 683
Hi there, I have a base class called Items and 3 derived classes, and within the Items base class i have a print function of the form
public void print(){
System.out.println("ID " + id + " Title " + title + " <" + year + "> ");
}
and within every derived class I call the Items print function through super.print();
which is followed by a specific print function relating to the derived class.
My problem is, whenever the printing is executed from one of the derived classes the printed text is not on the same line. So super.print()
will be in the line above the derived class print function. How do I get them both to be on the same line?
© Stack Overflow or respective owner