Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2014
    Posts
    2
    Rep Power
    0

    Default Switch loop problem. Help needed.

    So I'm currently learning java using the book: Java A Beginners Guide by Herbert Schildt.
    I cant apply my knowledge of the switch to modify this program.
    What i need is that the program runs the same but i can press q to stop the program and it will continue in a loop otherwise. repeating the same process i.e displaying the characters entered until q is pressed.
    How do i do it?
    I think i need to make use of do and while but no idea how to apply those in this case.
    Please help.


    Also i would appreciate it if someone could tell me when can i start learning android application development.
    Attached Thumbnails Attached Thumbnails Switch loop problem. Help needed.-untitled.png  

  2. #2
    Matrice is offline Member
    Join Date
    Jul 2014
    Location
    Mililani
    Posts
    37
    Rep Power
    0

    Default Re: Switch loop problem. Help needed.

    Nice code. How long have you been practicing?

    I think that your only concern should be that it works, at the very least.
    Okay, so, the do and while statements can be put into that code.
    Add more commentary to make that easier to understand.
    Look in the Internet for a Javadoc.
    A Javadoc can help you find references for do and while statements. Then, your job is to figure out where to put them. We can't really give you the answer, just a suggestion to help you find the answer that you're looking for.

  3. #3
    Matrice is offline Member
    Join Date
    Jul 2014
    Location
    Mililani
    Posts
    37
    Rep Power
    0

    Default Re: Switch loop problem. Help needed.

    I definitely like your Loop (for) statement!

    So your i is equal to 0, and since it's equal to 0, it will be less than the data.length, and when it's less than the data.length, increase the variable i by 1.

Similar Threads

  1. for loop problem. Help needed.
    By javastudent in forum New To Java
    Replies: 3
    Last Post: 06-08-2013, 08:43 PM
  2. help needed plz with some loop problem I guess
    By Tommeke in forum New To Java
    Replies: 6
    Last Post: 07-21-2011, 08:42 PM
  3. Help with while loop inside a switch case
    By Shesaid in forum New To Java
    Replies: 2
    Last Post: 04-01-2011, 04:36 AM
  4. how to do switch in while loop
    By earnest in forum New To Java
    Replies: 1
    Last Post: 03-01-2011, 02:45 AM
  5. Loop inside a switch
    By mustachMan in forum New To Java
    Replies: 3
    Last Post: 02-26-2010, 04:25 AM

Tags for this Thread

Posting Permissions

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