Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

Duplicate print lines but I only want it once

 
Lisa Beglaw
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Report post to moderator


If I have two movies, none of which are rented out, I get...
Total number of movies = 2
Of those movies 0 are currently rented out.
Total number of movies = 2
Of those movies 0 are currently rented out.

If I have three movies, the third one being rented out, I get...
Total number of movies = 3
Of those movies 0 are currently rented out.
Total number of movies = 3
Of those movies 0 are currently rented out.
Total number of movies = 3
Of those movies 1 are currently rented out.

How do I get my metod to print:
Total number of movies = 3
Of those movies 1 are currently rented out.

(Mabye I should re-think the wording of the rented out line...)
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Answered here.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic