Java Question: Is it possible to have a switch statement within another one? -


I do not have a yes or any question; answer. If yes, then I do not want to ask another yes or any questions. My trainer wants us to use charAt (0) as input to answer.

Is it possible that there should be a switch statement within each other (eg nested if statement)?

Thanks in advance

Edit: My proxy code =

  is a sample of the display "Do you want to add a link (y = yes Or n = no)? " Input Adlink Switch (Link) Case 'Y': Display "Would you like to pay 3 months in advance" + "(y = yes or n = no)?" Input Advance Payment Switch (Adpay) Case 'Y': Linkcast = 0.10 * (3 * 14.95) Case 'N' Linkcast = 14.95 Case 'N' Linkcast = 0.00  

Yes, but no. If you need another level of that kind of logic, then give the other change a descriptive name with your method.

EDIT: For the example you added, you will get two boolean statuses I if & amp; Instead use the else conditions (test.ttAt (0) == 'y') as the case of your test, or boolean isY (last String STRING) duly {return (STRING.charAt (0) = = 'Y' || STRING.charAt (0) == 'Y'); }


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -