Come to look at the masters

  Abstract: experts come to see 


  Try ( 
  A = Integer.parseInt (kob.getArea ()); 
  System.out.print (a); 
  ) Catch (NumberFormatException ex1) ( 
  System.out.print (ex1); 
  If (ex1.equals ( "") | | ex1 == null) ( 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 
  ) 
  You do so from out if it is INT has been assigned to a database of the operation if I do so only id = a check that his scope enough ah ~ 




  ? 



  Halo … 
  Your definition of a try in the outside 
  Int a = 0 
  Try ( 
  A =?; 
  ) 
  Catch () ( 

  ) 
  A method in the whole scope of the applicable 



  Int a = 0; 

  Try ( 
  A = Integer.parseInt (kob.getArea ()); 
  System.out.print (a); 
  ) Catch (NumberFormatException ex1) ( 
  System.out.print (ex1); 
  If (ex1.equals ( "") | | ex1 == null) ( 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 
  ) 




  Try ( 
  A = Integer.parseInt (kob.getArea ()); 
  System.out.print (a); 
  If (ex1.equals ( "") | | ex1 == null) ( 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 

  ) Catch (NumberFormatException ex1) ( 
  System.out.print (ex1); 
  ) 
  Changed so the best 




  Catch inside write these rare.    .    .    This will not improve code efficiency 



  Try ( 
  A = Integer.parseInt (kob.getArea ()); 
  System.out.print (a); 
  ) Catch (NumberFormatException ex1) ( 
  System.out.print (ex1); 
  If (ex1.equals ( "") | | ex1 == null) ( 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 
  ) 
======================================
  What this messy, so use? 

==>

  Try ( 
  Int a = Integer.parseInt (kob.getArea ()); 
  / / System.out.println (a); 
  String tsql = "select * from crm_areathree where id =" + a; 
  Rs = stmt.executeQuery (tsql); 
  ) Catch (NumberFormatException ex1) ( 
  Ex1.printStackTrace (); 
  ) 




  This is in order to fill because of abnormal operating in the database can not be read out when the judgement is not just numbers or strings unusual to use it to control you Xianxiao the issue is resolved ~ ~ 



  Up 



  Recommendations if (ex1.equals ( "") | | ex1 == null) ( 
  Changed if (ex1 == null | | (ex1.equals ("")) 
  Otherwise mistakes 



  Ex1 how likely equals ("")? 
  Niutoubuduimazui ah 


  ↑ Back 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Recommend Articles

Comments

Leave a Reply