Dear friends,

I'm developing a software for one of our assignments. But the problem is I's still learning these things.But since I have bunch of Java expert friends I have no fear to face it ;) .So friends this is the code.

package census;


import java.io.*;
public class Main {

    
    public static void main(String[] args) {

      //  house[] home =new house[10];
        house h1=new house();
        


int input=0,nic;
String temp;
try{
        BufferedReader buff2 = new BufferedReader(new InputStreamReader(System.in));

        System.out.print("What do you wanto do ?");
         System.out.print("\n Add new person ------------------ 1  ");
         System.out.print("\n view person details ------------- 2  ");
         System.out.print("\n Add new Factory/State ----------- 3  ");

          temp = buff2.readLine();
          input=Integer.parseInt(temp);
         // System.out.print(input);

          switch(input){
    
    case 1:
       // home[0].setData();
        h1.setData();
        break;
        
    case 2:

        System.out.print("\n Enter the NIC no of the person   : ");
        temp = buff2.readLine();
        nic=Integer.parseInt(temp);
      System.out.print(h1.getDetails(nic));
      break;

    case 3:
    
}
          
          
          
    }catch(Exception e){
           System.out.print("\n Error--"+e.toString());
        }





    }

}

The problem is I want following to happen but I don't have any idea how to jump through statements,

1. when user select 1 then case 1 execute (line 31)
2.after that user must prompt to enter another choice instead of exit the switch (line 20)

Is there any way like goto keyword in C Thank you in advanced...

If I understand what you are asking correctly, you could just wrap everything from line 20 to the end of the switch statement in a while(true) loop.

If I understand what you are asking correctly, you could just wrap everything from line 20 to the end of the switch statement in a while(true) loop.

oh god yes..how can I not come up with that... :O I'm very dull..thank you friend

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.