Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9197651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:07:13+00:00 2026-06-17T22:07:13+00:00

Possible Duplicate: Is there a goto statement in java? In my android application i

  • 0

Possible Duplicate:
Is there a goto statement in java?

In my android application i used goto statement to control the flow. But I received error as “Syntax error on token goto, throw expected”. Here is my code

label:
if(alc)
{
  r_code=st.nextToken();
  AlertDialog.Builder alert=new AlertDialog.Builder(Fetch.this);
  alert.setTitle(count+" records found for "+rytname.getText().toString());
  alert.setMessage("Are you sure want to search for "+r_code+"?");
  alert.setPositiveButton("YES", new DialogInterface.OnClickListener() {

    @Override
    public void onClick(DialogInterface dialog, int which) {
      ff=1;
      alc=false;
    }
  });

  alert.setNegativeButton("NO", new DialogInterface.OnClickListener() {

   @Override
   public void onClick(DialogInterface dialog, int which) {
      // TODO Auto-generated method stub
      ff=0;
   }
  });
  alert.show();
  if (ff==0)
  {
    goto label;
}

I’m new to this android, and help me to avoid this error

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:07:15+00:00Added an answer on June 17, 2026 at 10:07 pm

    Instead of:

    label:
    ...// the rest of your code
    if (ff == 0) 
    {
        goto label;
    }
    

    Use this:

    do {
    ...// the rest of your code
    while (ff == 0);
    

    Even better if you can convert it to:

    while (ff == 0) {
    ...// the rest of your code
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: goto keyword in java There is no goto in java, right ?
Possible Duplicate: Is there a difference between single and double quotes in Java? I've
Possible Duplicate: Is there a ‘new’ modifier for methods in Java? In c#, a
Possible Duplicate: Is there already a Google+ API? Is it possible to develop application
Possible Duplicate: Is there a simpler way to do this if statement in C#
Possible Duplicate: Is there a difference between x++ and ++x in java? Can anyone
Possible Duplicate: Is there a way to embed a browser in Java? I am
Possible duplicate: Hey there, I am building a form which is used to query
Possible Duplicate: Is there a proved mouseOver workaround for FirefoxDriver in Selenium2? I want
Possible Duplicate: Is there any hash function in PL/SQL? I have a column with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.