Go Back   Cloud Computing > Support > PHP Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-18-11, 08:27
Kristine Habeck's Avatar
BOD Member
 
Join Date: Nov 2010
Posts: 122
Default Java query

Hi

I am looking for a solution in Java, which helps to create switch statements in a switch statements? What I wan to do is a to get something similar to a list of options and when user choose one of them, user will gets more options for selections. Is there any simple way to do this?
Reply With Quote
  #2 (permalink)  
Old 02-18-11, 08:28
BOD Member
 
Join Date: Nov 2010
Posts: 95
Default

For such kind of functionality you need create switch statements pass control to another method that will quick the next menu, manage the input, and then run back to the first switch, which checks the return value from the nested menu if required and redisplay the original menu.
Reply With Quote
  #3 (permalink)  
Old 02-18-11, 08:32
Rozanne's Avatar
BOD Member
 
Join Date: Nov 2010
Posts: 116
Default

You can do this but I think all in one function will mess up and quite looks like unusual style. In this way menu will fully enclosed in its own functionality, which again makes it easier to debug and will change the order of the menus if that is required in future.
Reply With Quote
  #4 (permalink)  
Old 02-18-11, 08:34
BOD Member
 
Join Date: Nov 2010
Posts: 81
Default

Whatever it is, but according to my knowledge nested switch statements are allowed in almost all the programming languages including Java as well.
Reply With Quote
  #5 (permalink)  
Old 02-18-11, 08:36
Rozanne's Avatar
BOD Member
 
Join Date: Nov 2010
Posts: 116
Default

I'd like to include few more information here, nested switch statements are not necessarily a good practice. You'll find more ways of expressing control logic. You should refer several books where you will get many suggestion along with the concern issue.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 01:07.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.