|
-
Feb 15th, 2004, 12:09 PM
#1
Thread Starter
Addicted Member
System.out.println NEW LINE
Hey can anyone help
I'm trying to print out the following using the code below:
The following bedrooms are occupied:
Room number 6 is occupied by evans, with payee private
Room number 7 is occupied by jones, with payee private
Room number 16 is occupied by smith, with payee uog hei
End of bedroom report
but ever time i compile it comes up all in one line. but if i use \n it gives me an error "Invalid escape character"
any ideas?
thanks
Code:
public void bedroomReport()
{
String customerName = "";
String payeeName = "";
int roomNumber = 0;
boolean occupied;
int counter = 1;
while (counter <= MAX_BEDROOMS)
{
if (bedrooms[counter].isOccupied())
{
System.out.print("The following bedrooms are occupied:");
System.out.print("Room number " + bedrooms[counter].getRoomNumber() + " is occupied by " + bedrooms[counter].getCustomerName() + " , with payee " + bedrooms[counter].getPayeeName());
}
counter++;
}//end of while
-
Feb 15th, 2004, 12:30 PM
#2
You are using print(), not println().
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Feb 15th, 2004, 12:53 PM
#3
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|