Page 1 of 2 12 LastLast
Results 1 to 20 of 24
  1. #1
    welikedogs is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default print every other line

    i have a file that i want to read from and also print out.

    However i want to print every other line.

    how would i go about doing this?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default

    What have you tried?

  3. #3
    welikedogs is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default dont know what to change

    ive got a code that prints out lines of text. but i really dont know where to start. reckon you can help kevin.

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default

    If you have code, post an SSCCE. I'm not sure what you're expecting here (or on the other forum you've posted to), but you aren't just going to get code without showing any work. This isn't a homework service.

  5. #5
    welikedogs is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default

    who says its a homework service you plum. i dont know where to start and was looking for some help. so why dont you sign up to a forum that doesnt give help rather than a forum that does...

    i believe i am in the new to java section. prick

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default

    This isn't a homework service.
    Seconded. Stop dumping your homework across two (or more?) forums and spend time with your text books.

    db

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,785
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by welikedogs View Post
    ive got a code that prints out lines of text. but i really dont know where to start. reckon you can help kevin.
    If this is your code:

    Java Code:
    while (not everything read) {
       readLine();
       printLine();
    }
    ... add a little boolean:

    Java Code:
    boolean printIt= false;
    while (not everything read) {
       readLine();
       if (printIt)
          printLine();
       printIt= !printIt;
    }
    Change the inital value to true if you want to print the first, third etc. lines instead of the second, fourth etc. lines.

    kind regards

    Jos

    ps. what a giveaway ... ;-)

  8. #8
    welikedogs is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default

    cool mate ill give that a try. thanks allot

  9. #9
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default

    Quote Originally Posted by welikedogs View Post
    who says its a homework service ...
    Obscene response reported.

    db

  10. #10
    welikedogs is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default

    darryl are you serious? i seriously dont know what your problem is. Really hate the sort person that you are. One of these clicky forum person that dont like to help people out. And if there was a report button for being an absolute cunt i would click it twice.

  11. #11
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    Your kind aren't welcome here. The people on this forum are volunteers who give their time to help prospective Java programmers, and you're repaying them with impatience, insensitivity and arrogance. Grow up.

  12. #12
    welikedogs is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default

    i agree with what zack is saying. You are clearly not trying to help anyone and you are definatly very arrogant.

  13. #13
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    I wasn't talking to him.

  14. #14
    welikedogs is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default

    oh you was talking to kevin?

  15. #15
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    Very cute, OP. Hope you have fun finding a new forum, cause no one's gonna' help you here anymore.

  16. #16
    welikedogs is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default

    you lot just jumped on me so fuck off zack you prick?

  17. #17
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    I wouldn't call it getting "jumped on" after a comment like "i believe i am in the new to java section. p***k".

    Regardless, I'm done discussing this with you. You're aware that you're not welcome here, and we're aware that we're not going to help you. There's nothing more that has to be said.

  18. #18
    welikedogs is offline Member
    Join Date
    Nov 2010
    Posts
    11
    Rep Power
    0

    Default

    except your a fucking cunt. im done now

  19. #19
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Delightful...
    You'll go far in this business with that attitude.
    I can see the requirements gathering meetings with your clients now...would you video them and stick them on YouTube?

  20. #20
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,785
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Tolls View Post
    Delightful...
    You'll go far in this business with that attitude.
    I can see the requirements gathering meetings with your clients now...would you video them and stick them on YouTube?
    Mwah, I expected a bit more creative cursing; like "You malodorous heap of parrot droppings! Your type makes me puke! Your father smells like elderberries and your mother is a hamster! You pervert!". Something like that ...

    kindest regards,

    Jos ;-)

Page 1 of 2 12 LastLast

Similar Threads

  1. print to the next line
    By bar in forum New To Java
    Replies: 14
    Last Post: 07-15-2010, 02:48 AM
  2. Print to next Line
    By singularity in forum New To Java
    Replies: 13
    Last Post: 09-10-2009, 10:03 AM
  3. Print the text file and print preview them
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-23-2008, 12:04 AM
  4. print line
    By kazitula in forum Java Applets
    Replies: 2
    Last Post: 01-26-2008, 03:05 PM
  5. how to print output on same line in 'while loop'?
    By acidblue in forum New To Java
    Replies: 5
    Last Post: 12-13-2007, 03:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •