3 Replies Latest reply: Mar 17, 2014 9:29 AM by TPD-Opitz RSS

    while loop in java

    Tshifhiwa

      hi how can i do this in best way, i what to avoid infinite loop

       

      the use case is i get value from use and query value from database,sometime use can send value which return null in database,i what to avoid those null value

        • 1. Re: while loop in java
          TPD-Opitz

          please use code tags for better readability of your code and pay attention to proper indentation for the same reason.

           

          please show me in the place in you while loop where you assign new values to  s_Activedate and s_Inactivedate.

           

          bye

          TPD

          • 2. Re: while loop in java
            gimbal2

            The code is a mess without much thought behind it if I have to be bluntly honest. Notice the null-checks after the variables have already been referenced.

             

            while(s_Activedate.length() > 0 && s_Inactivedate.length() > 0){
                   if(s_Activedate != null){
                       if(s_Inactivedate != null){
            
            

             

            I wish you good luck.

             

            PS: are there code tags now? I have to go to the advanced editor and manually activate syntax highlighting. And then you get this mess I just posted.

            • 3. Re: while loop in java
              TPD-Opitz

              gimbal2 wrote:

               

              PS: are there code tags now? I have to go to the advanced editor and manually activate syntax highlighting. And then you get this mess I just posted.

              Your'e right, Code tags, performance an clarity have gone with the old forum...

              : o(

               

              bye

              TPD