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 8827741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:26:40+00:00 2026-06-14T07:26:40+00:00

i was using If-Else Statement in my validation function. I had a validation class

  • 0

i was using If-Else Statement in my validation function.
I had a validation class with all the validation functions then i accessed these methods via the object of the Validation class .
what happened is that the control was going inside both the conditions

if(some cond ..)
System.out.println("inside IF");
else
System.out.println("inside ELSE");

I also tried

if(some cond ..)
{
System.out.println("inside IF");
}
else
{
System.out.println("inside ELSE");
}

in both the cases the control was going inside both the conditions and printing both the lines.
I could not explain this to my self , no matter what condition i give if this is not a syntax error it should only go in either of the loop but not both

CAN ANYBODY EXPLAIN HOW CAN IT BE POSSIBLE THAT BOTH THE IF AND ELSE CONDITIONS BEING EXECUTED ???

I made some other irrelevant changes in my project and after some time it was working fine , but at that time i could not explain my self how it was possible

btw if it matters , i was using this class inside a android project thus android compiler was being used

  • 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-14T07:26:41+00:00Added an answer on June 14, 2026 at 7:26 am

    You mean if-else conditional statements, not loops.

    It sounds like a threading issue. You probably have a thread that goes on one route, while another one calls the same method and goes on the other path. This is how you can get both strings displayed.

    In order to debug this, you could print Thread.currentThread() at the end of each System.out.println call. I’m sure you will see different Thread object addresses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery to create a client-side validation function for a .NET form.
I have an array of site options. Then I've a function that validates all
Is there any reason why Crockford recommends using the else statement on the same
I'm using gcc 4.7.0, in c89 mode. I have this if-else statement and have
I'm using the following code to enable an if/else statement. <?php $types = array('.pdf',
I want to Join multiple tables using IF ELSE statement within Sql Query when
I am using if else statements in awk . Everytime when I use it
I am working on an Outlook add-in written by someone else using VSTO 4.0.
I am writing an if/else alternative using a table driven method. I have the
using stdout library it will maybe pass data to logcat or somewhere else which

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.