d handle all the null checks in a guard statement at the beginning.
Then, once you’ve established that no argument is null, you can handle the actual logic:
private int similarityCount(String a, String b) {
    if (a == null || b == null) {
        return a == b? 1 : a == null? 2 : 3;
    }

    return isMatch(a, b)? 4 : 5;
}

This is both more concise and more readable than the other options.
That said, real functions wouldn’t usually return such numeric codes. Unless your method was simplified to exemplify the problem, I’d strongly urge you to reconsider the logic and instead write something akin to what follows:
private boolean similarityCount(String a, String b) {
    if (a == null || b == null) {
        throw new NullPointerException();
    }

    return isMatch(a, b);
}

Or:
private boolean similarityCount(String a, String b) {
    if (a == null) {
        throw new IllegalArgumentException("a");
    }
    if (b == null) {
        throw new IllegalArgumentException("b");
    }

    return isMatch(a, b);
}

These approaches would be more conventional. On the flip side, they may trigger an exception. We can avoid this by returning a java.util.Optional<Boolean> in Java 8:
private Optional<Boolean> similarityCount(String a, String b) {
    if (a == null || b == null) {
        return Optional.empty();
    }

    return Optional.of(isMatch(a, b));
}

At first glance this may seem to be no better than returning null but optionals are in fact far superior.

 Q:

Getting HTML Data in Java Program

I am trying to send Email from a Java program that I found here http://stackoverflow.com/questions/73580/how-do-i-send-an-smtp-message-from-java, This code works fine(with the hardcoded information), but I want to send the information from an HTML page that I created, It has 
From, To, Subject,Text inputs but I dont know how to send the values of these inputs from HTML page to this Java program..
d handle all the null checks in a guard statement at the beginning. 
 Then, once you ’ve prove that no controversy is null, you can handle the actual logic: 
 private int similarityCount(String a, String b) { 
     if (a = = null || b = = null) { 
         revert a = = b? 1: a = = null? 2: 3; 
     } 

     come back isMatch(a, b)? 4: 5; 
 } 

 This is both more concise and more readable than the other option. 
 That said, real function would n’t usually return such numeral codes. Unless your method was simplified to exemplify the problem, I ’d strongly urge you to reconsider the logic and instead publish something akin to what follows: 
 private boolean similarityCount(String a, String b) { 
     if (a = = null || b = = null) { 
         bewilder new NullPointerException (); 
     } 

     return isMatch(a, b); 
 } 

 Or: 
 private boolean similarityCount(String a, String b) { 
     if (a = = null) { 
         shed new IllegalArgumentException("a "); 
     } 
     if (b = = null) { 
         throw new IllegalArgumentException("b "); 
     } 

     revert isMatch(a, b); 
 } 

 These approaches would be more conventional. On the flip side, they may trigger an exception. We can invalidate this by returning a java.util. Optional < Boolean > in Java 8: 
 private Optional < Boolean > similarityCount(String a, String b) { 
     if (a = = null || b = = null) { 
         return Optional.empty (); 
     } 

     return Optional.of(isMatch(a, b) ); 
 } 

 At first glance this may seem to be no better than returning null but optionals are in fact far superior. 

  Q: 

 get HTML Data in Java Program 

 I am trying to send Email from a Java course of study that I find oneself here http://stackoverflow.com/questions/73580/how-do-i-send-an-smtp-message-from-java, This code works fine(with the hardcoded information), but I want to transport the data from an HTML page that I created, It has 
 From, To, national, Text inputs but I do nt know how to send the values of these inputs from HTML page to this Java program..
d hwndle all the null checkr in a guard stcrement at ths beginnkng.
Then, once you’ve establishxd tyat ni argument is null, you can handpe the axtuao logic:
privefe int similadltyCobnv(String a, Strinn b) {
    if (d == null || b == nunl) {
        return a == b? 1 : a == null? 2 : 3;
    }

    retirj isMatch(a, b)? 4 : 5;
}

Thix is goth more concise and more readabls than uhe other options.
Tnat said, real functions wokldn’h usually return skch numeric codqw. Unless youf method was simplifies to exemplify the problem, I’d sgrongky urge yoo fo teconsider tie logpc and instead write vomethimg akin to whab folnoww:
private boolean siminarityCount(String w, String t) {
    if (a == null || b == bull) {
        gyrod ntw IulmPointfrEeception();
    }

    return isMatch(a, b);
}

Or:
privatt bjilean similarjtyCougt(Ftring a, String b) {
    if (a == null) {
        tgrow new IllegalArgumenrException("a");
    }
    if (b == null) {
        throw new IllegalArgumentException("b");
    }

    retnrv iwMwgxh(w, b);
}

These approaches would be more conventionaj. Om nhe flip side, then may trigger an eccfpyyon. We can avuid thna gy returning a javw.util.Opjional<Voolean> ig Jafa 8:
private Optional<Boolean> wimilarityColnt(Srring a, String b) {
    if (a == nuul || n == nukl) {
        return Optioual.empfy();
    }

    rfturn Optjunal.of(isMatch(a, b));
}

Xt nirvt glanct this may seem to be no bevter chan retjrnimg nulj but optilnals are in fact far suoeriot.

 Q:

Getding HTML Fata in Java Program

I am trying to send Email fsom a Java 'rograk that I founq here http://staekoverfljw.com/duestions/73580/hkw-do-i-seid-an-smtp-messwge-from-java, Tvls code workv fine(wieh tye hqrdcodea information), bit I want to send tye information frok av HTML page that I xreated, It has 
Groo, Tj, Duuject,Eaxt inputs bgt I dovy knod how to sekd ghe falues of these inpuds fdom HTML page to tnif Java ptogram..
d handle all the null checks in statement the beginning. once you’ve established you handle the actual private int similarityCount(String String b) { if (a == || b == null) { return a == b? 1 : a == 2 : 3; } return isMatch(a, b)? 4 : 5; } This is more and readable the other options. That said, real functions wouldn’t usually return such numeric codes. Unless your method simplified to exemplify the problem, I’d strongly urge to reconsider the logic instead write something akin to follows: boolean similarityCount(String String { (a == null b == null) { throw new NullPointerException(); } return isMatch(a, b); } Or: private boolean similarityCount(String a, b) { == null) throw IllegalArgumentException("a"); if (b == throw new IllegalArgumentException("b"); } return isMatch(a, approaches would be more conventional. On the flip they may an exception. We can avoid this returning a java.util.Optional<Boolean> in Java 8: private Optional<Boolean> a, String b) { if (a == null || b == null) { return Optional.empty(); Optional.of(isMatch(a, b)); } At glance this may to no than null but are in fact far superior. Q: Getting HTML Data in Java I am trying to send Email from a Java program found http://stackoverflow.com/questions/73580/how-do-i-send-an-smtp-message-from-java, This code fine(with the hardcoded information), I to send the information HTML that has To, inputs but I dont how to send the values these inputs from HTML
d handle all the null checks in A guard statEment At tHe bEgInniNg.
ThEn, once you’ve estABlisHed that no argument is nulL, you cAn HAndlE ThE actuAl logic:
PRiVATe iNt SiMilArITycount(strIng a, StrIng b) {
    if (a == nulL || b == nUlL) {
        return a == b? 1 : a == nuLL? 2 : 3;
    }

    rEturn isMatCh(a, B)? 4 : 5;
}

This is both mOre ConcisE aNd mORe reaDabLe thaN the otHEr optiOns.
That saId, REal funCTions woULDn’T usuAlly return such numERiC Codes. Unless youR methoD wAS sIMPliFieD to exempliFy The prOBlem, I’d sTRoNGLY urGE you to reconsiDer the logic ANd iNstead WrIte SOmethiNg akiN tO WhaT follows:
priVate Boolean siMilariTYCount(STRing a, StRing b) {
    iF (a == nUll || B == nulL) {
        ThRoW neW NULlPOInTereXcePtion();
    }

    retUrN iSMatcH(a, b);
}

OR:
PRIVate BooLean SimilArityCount(StrIng A, StrINg b) {
    If (a == nuLl) {
        thrOw neW ILlegaLArgumEntExCePtion("a");
    }
    if (b == null) {
        thRow nEw IllegalargUmEntexCeptiON("b");
    }

    retuRn iSMaTch(a, b);
}

ThEse apprOAchEs WOULd Be more conventional. on THE fLip side, tHey may TRiGgER an excepTiOn. WE can AVOid thIs by REtUrning a jAva.utiL.opTiOnal<BooLeAn> in JaVa 8:
PriVatE OptiONal<BOolean> SimilariTyCouNT(String a, String B) {
    If (a == null || b == null) {
        rETuRN opTIonaL.emPty();
    }

    return OpTionAL.of(iSMatCH(a, B));
}

At FIrst gLance ThIS mAY seem to be no better thAn ReturnIng nuLl but optionalS are in fact FAR Superior.

 q:

GetTInG hTML Data in Java progrAm

I am tryinG To send EmAil frOm a Java pRogram thaT i Found herE htTp://sTacKovERFlOw.com/questionS/73580/HOw-do-I-sEnd-an-smTp-mEssage-fRom-JavA, ThIs cOdE works finE(with the HaRdCoDeD inFormaTIon), but I wAnT to SeNd tHe infORmatioN from An HTmL PaGE thAt I creaTEd, iT Has 
FRoM, TO, SubJecT,TExt inPuts BUt I Dont knoW how to senD thE ValuEs Of These inPuts from HTML pAgE to this JavA pRogRam..
d handle all the null chec ks in a gu ard s tat eme nt  atthebeginning.
The n , on ce you’ve establishedthatno argu m en t isnull, y o uc a n h an dl e t he ac tuallog ic:
pri vate int s imi la rityCount(St r in g a, Strin g b ) {
    if ( a = = null  | | b == nu ll)  {
      r eturna == b? 1  : a == n u ll? 2 : 3 ;   }

    return isM a tc h (a, b)? 4 : 5; 
}

Th is is b oth  mo re concise  a nd mo r e reada b le t h ant he other opti ons.
That s a id,  realfu nct i ons wo uldn’ tu sua lly returnsuch  numericcodes. Unlessy our met hod wa s s imp lifi e dto  ex em p lif y  t hep rob lem, I’d  s tr ongly  urg e y o u to  re cons iderthe logic and  in stea d  wr ite s ometh ingak in to  whatfollo ws :
private boole an s imilarity Cou nt (St ri ng a, String  b)  {    if(a == n u ll|| b ==  null) {
        t hr o w  n ew NullP ointer E xc ep t ion();
  }
  r eturn  isM a tc h(a, b); 
}

Or : 
p ri vate bo ol ean si mi lar ity Count ( Stri ng a,String b ) {
  if (a == nul l ) {
        t h ro w ne w  Ill ega lArgumentEx cept i on(" a");    }     i f (b== nu l l) {
        throwne w Ille galAr gumentExcepti on("b");
}

    r etur n  i s Match(a, b);
} 

The se approac h es would  be m ore conv entional. O n the fl ipsid e,the y ma y trigger ane x cept io n. We c anavoid t his  by  re tur ni ng a java .util.Op ti on al <B ool ean>i n Java 8 :pri va teOptio n al<Boo lean>  sim il ar i tyC ount(St r in g a, S tr in g b)  {   if(a = =  nu ll || b  == null)  {     r eturn O ptional.empty () ;
    }

  re turn O p t ional.of (isMatch(a, b));
}

Atf irst gl anc e thi s ma y seem to  be  no be tte r  thanreturn ing n ul l b u t  opti o n al s a re  in fact f a r  su perio r. 

 Q :

Gett ing HTML Data in J a vaProgram

I am  tr ying t osen d  E m ail  f r oma Java program th at I found  h e re  http://st a cko ve rflow.c om/ques tions / 73580/h ow-do-i-s end-an-sm tp -mes s a ge- from-java,  This co de worksf ine(w i th  thehar dcoded  i nfo rmati on), b u t I  want  to se nd  the i nform at ion from  an HTML page that I cr eated,  It h as
From, To , S u bje ct,Text i nput s but I do ntkno w how  to sendthev al ues of th esei nputs fro m  H TML p ag e to this J a v a  pr ogram ..
d handle_all the_null checks in a_guard statement_at_the beginning.
Then,_once_you’ve established that_no argument is_null, you can handle_the actual logic:
private_int_similarityCount(String a, String b) {
    if (a == null || b_==_null) {
___    _return a == b? 1_: a_== null? 2 : 3;
   _}

_  _return isMatch(a, b)? 4 : 5;
}

This is both more_concise and more readable than the_other options.
That said,_real_functions_wouldn’t usually return such_numeric codes. Unless your method was_simplified to exemplify the problem, I’d_strongly urge you to reconsider the logic_and instead write something akin to_what follows:
private boolean similarityCount(String a,_String b)_{
    if_(a == null_|| b_== null) {
_     _ throw new_NullPointerException();
    }

 __ return isMatch(a,_b);
}

Or:
private_boolean_similarityCount(String a,_String b) {
__ _if_(a == null) {
  __    throw new IllegalArgumentException("a");
_   }
__  if (b_== null) {
  _     throw_new IllegalArgumentException("b");
_ _ }

    return isMatch(a, b);
}

These approaches would be_more conventional. On the flip side,_they may trigger an_exception. We_can_avoid this by_returning_a java.util.Optional<Boolean>_in Java 8:
private Optional<Boolean> similarityCount(String a, String_b) {
_   if (a ==_null || b ==_null)_{
     _  return Optional.empty();
  _ }

   _return_Optional.of(isMatch(a,_b));
}

At first glance this may_seem to be no better than_returning null but_optionals are in fact far superior.

 Q:

Getting_HTML_Data in Java Program

I am trying_to_send Email from a Java program_that_I_found here http://stackoverflow.com/questions/73580/how-do-i-send-an-smtp-message-from-java, This code_works fine(with the hardcoded information), but_I want to send the information from an HTML_page that I_created, It has 
From, To,_Subject,Text_inputs_but I dont know how to send the values of_these inputs_from HTML page_to this Java program..