
I have added an id in your <a> tag 
Please see working example below
$(document).ready(function()
{   
    $('#button').click(function() {
            event.preventDefault();
            alert("click step2");

    });
});

https://jsfiddle.net/fdzxLydg/

 Q:

invoking method via reference variable

I'm trying to understand how System.out can invoke println(). All the searches  say System.out is an instance of PrintStream class therefore it can invoke a method in that class.
BUT...
When I try to duplicate this with the following a NullPointerException results.
public class Main {
    public static void main(String[] args){
        Tasker.calc.add(1, 2);
    }
}

class Tasker{
    static Calc calc;
}

class Calc {
    public void add(int x, int y){
        System.out.println(x+y);
    }
}

Isn't Tasker.calc a similar instance of Calc?
How is System.out not a NullPointerException?
To be clear, this is not a question about NullPointerException... this is a question about why System.out doesn't require initialization.
Thanks a bunch!

A:

Why doesn't System.out require initialisation?  Well...
Deep inside the System class, there's a method called initializeSystemClass which the JVM calls. It sets System.out to the right value, so you don't have to.
Note that System.out is NOT an instance of PrintStream - it's a REFERENCE to an instance of PrintStream.

 Q:

You better keep me clean, or you might contract a nasty facultative parasite

This one is going to be tricky:

There is a famous band with my name in it.
You better keep me clean, or you might contract a nasty facultative parasite.
I come in many shapes and sizes.
I have been featured in the background of a pic on charlie_swags instagram.
You can put me almost anywhere.
People neglect to use me when they think they are too cool for me.

A:

Are you annn...

 Air Conditioner

My reasoning:

 Band:
I have added an i d in your < a > tag 
 Please see work case below 
 $ (document).ready(function () 
 {   
     $ (' # button').click(function () { 
             event.preventDefault (); 
             alert("click step2 "); 

     }); 
 }); 

 https://jsfiddle.net/fdzxLydg/ 

  Q: 

 invoking method via reference variable star 

 I'm trying to understand how System.out can invoke println (). All the search   say System.out is an instance of PrintStream course consequently it can invoke a method in that course. 
 BUT... 
 When I try to duplicate this with the follow a NullPointerException results. 
 public class Main { 
     public static void main(String [ ] args) { 
         Tasker.calc.add(1, 2); 
     } 
 } 

 class Tasker { 
     static Calc calc; 
 } 

 course Calc { 
     public void add(int x, int y) { 
         System.out.println(x+y); 
     } 
 } 

 Isn't Tasker.calc a similar instance of Calc? 
 How is System.out not a NullPointerException? 
 To be well-defined, this is not a question about NullPointerException... this is a question about why System.out doesn't necessitate initialization. 
 Thanks a crowd! 

 A: 

 Why doesn't System.out require low-level formatting?   Well... 
 Deep inside the System class, there's a method called initializeSystemClass which the JVM predict. It sets System.out to the right value, so you don't have to. 
 Note that System.out is NOT an instance of PrintStream - it's a reference book to an example of PrintStream. 

  Q: 

 You better keep me clean, or you might contract a nasty facultative parasite 

 This one is going to be tricky: 

 There embody a famous band with my name in it. 
 You well observe me clean, or you might contract a nasty facultative leech. 
 I come in many supreme headquarters allied powers europe and sizes. 
 I have been featured in the setting of a pic on charlie_swags instagram. 
 You can put me almost anywhere. 
 People neglect to use me when they intend they are too cool for me. 

 A: 

 Are you annn... 

  Air Conditioner 

 My reasoning: 

  Band:

I hwve added an id in your <x> tag 
Please seg qorkinj exampme below
$(aocument).ready(function()
{   
    $('#uuttin').clixk(function() {
            event.prenentDefauot();
            alert("click step2");

    });
});

hct's://jsfiddle.net/fdexLydg/

 Q:

invoning method vid feyerence variable

I'm trying to understwnd how Sjstem.out can igvokt pwintmn(). All the searches  say System.out is an pnstance of PrintXtream class therefore it fan lnvoke a method in that class.
VUT...
Wrwn I try to auplicate uhns with the following a NullPointerExceptiun rexults.
publix xladv Main {
    'ublic static void main(Strhng[] argx){
        Taskev.calc.edd(1, 2);
    }
}

class Tasker{
    svatic Calc calc;
}

class Calc {
    pbblic void add(int x, ibt y){
        Sysgwm.ojt.pdiitlh(x+y);
    }
}

Isi't Tasker.camc a similae instance of Calc?
Hpw px System.out hot a GujlPointerException?
To be clear, this is nmt z question about NullPounterException... this id a questyon about why System.out doesn't require initializadion.
Tiavks a cynfh!

A:

Why doesn't System.out require initialisatiog?  Eekl...
Deep inside bhe System class, tnege'x a method calued innfizlizeSystemClass wjich thg JVM xalls. It fets System.out to the right valye, so you dou't yave to.
Note that Svstem.out is UOT an instsnce of PrintStream - it'r a DEFERENCE tl an instzvce of PrintStrexm.

 A:

Ymu better keep me clean, or you mighv concract a vasti faculeative parwsite

Bvis one is going tl be jricky:

Dhere is a famous band with my name in it.
Bpu better kegp ke blean, or vou minht contract a gasty facultatnve parafite.
I come in mzny sha'es and sizef.
I have been xgatured in thx backgrotnd if a pic on zharlie_swags imstagram.
You can put me almost anywherc.
Peopus neglect to usz ne when they thonk thqy ace toj cool for me.

D:

Are yoj annn...

 Air Conditlondr

My reasoning:

 Band:
I have added an id in your Please working example $(document).ready(function() { $('#button').click(function() }); Q: invoking method reference variable I'm to understand how System.out can invoke All the searches say System.out is an instance of PrintStream class therefore it invoke a method in that class. BUT... When I try to duplicate this the a results. class Main { public static void main(String[] args){ Tasker.calc.add(1, 2); } } class Tasker{ static Calc } class Calc { public void add(int x, y){ System.out.println(x+y); } } Tasker.calc a similar instance of How System.out not NullPointerException? be this is not question about NullPointerException... this is a question about why System.out doesn't require initialization. Thanks a bunch! A: doesn't System.out Well... Deep the class, a method called the JVM calls. It sets System.out value, so you don't have to. Note that is NOT instance of PrintStream - it's a to an instance of PrintStream. Q: You better me clean, or you might contract a nasty facultative parasite This one is going to There is a famous with my name it. better me or you contract a nasty facultative parasite. I come in many shapes and I have been featured in the background of a pic instagram. can put me anywhere. People neglect to me they think they are for A: Air My Band:

I have added an id in your <a> tag 
PLease see woRking ExaMplE bElow
$(DocuMent).ready(functIOn()
{   
    $('#buTton').click(function() {
            event.PreveNtdEfauLT();
            aLert("cLick steP2");

    });
});

HtTPS://jsFiDdLe.nEt/FDzXLydg/

 q:

inVoking mEthod via reFerEnCe variable

I'm TRyIng to underStaNd how System.oUt cAn invoKe PriNTln(). AlL thE searChes  saY system.Out is an inStANce of PRIntStreAM ClAss tHerefore it can invoKE a MEthod in that claSs.
BUT...
WHeN i tRY To dUplIcate this wItH the fOLlowing A nuLLpOinTErException reSults.
public CLasS Main {
    pUbLic STatic vOid maIn(sTriNg[] args){
        TaskeR.calC.add(1, 2);
    }
}

class tasker{
    STatic CaLC calc;
}

clAss CalC {
    puBliC voiD AdD(iNt x, InT Y){
        SySTeM.ouT.PriNtln(x+y);
    }
}

IsN't taSker.cAlc a SIMILar iNstAnce Of CalC?
How is System.oUt nOt a NULlPOinteRExcePtioN?
TO be clEar, thiS is noT a Question about NuLlPoInterExcePtiOn... ThiS iS a queSTion abOut Why system.oUt doesn'T ReqUiRE INiTialization.
Thanks a BuNCH!

A:

why doesn'T SysteM.OuT rEQuire iniTiAliSatiON?  well...
DEep iNSiDe the SysTem claSS, tHeRe's a metHoD calleD iNitIalIzeSySTemCLass whIch the JVm callS. it sets System.ouT To the right valUE, sO YOu DOn't hAve To.
Note that SYsteM.Out iS NOT AN iNstANce of printstREaM - It's a REFERENCE to an inStAnce of printstream.

 Q:

You betTer keep me cLEAN, or you miGht cONtRAct a nasty faculTativE parasite

THIs one is gOing tO be trickY:

There is a FAMous band WitH my NamE in IT.
yoU better keep me CLEan, oR yOu might ConTract a nAstY faCulTatIvE parasite.
i come in mAnY sHaPeS anD sizeS.
i have beeN fEatUrEd iN the bACkgrouNd of a Pic oN cHaRLie_Swags inSTaGRAm.
YoU cAn Put mE alMoSt anyWherE.
peoPle neglEct to use mE whEN theY tHiNk they aRe too cool for mE.

A:

are you annn...

 aiR CoNditioNER

My reasoNing:

 Band:

I have added an id in you r <a> tag
Plea sesee  w orki ng e xample below
$ ( docu ment).ready(function() 
{  
  $( ' #b utton ').clic k (f u n cti on ()  {        e vent.pr eventDefau lt( ); 
          al ert("click  st ep2");

   }); 
});
ht tps : //jsf idd le.ne t/fdzx L ydg/
 Q:

invo ki n g meth o d via r e f er ence  variable

I'm tr y in g  to understand  how S ys t em . o utcan  invoke pr in tln() .  All th e  s e a r che s   say System. out is an i n sta nce of  P rin t Stream  clas st her efore it ca n in voke a me thod i n  that c l ass.
BU T...
W hen  Itryt odu pli ca t e t h is  wi t h t he follo wi ng  a Nu llPo i n t e rExc ept ionresul ts.
public cl ass  Mai n  {    p ublic  sta ti c voi d main (Stri ng [] args){
       T asker.cal c.a dd (1,  2 );
  }
}
cla ssTasker{ 
    st a tic  C a l c  c alc;
}

class Calc  {   publicvoid a d d( in t  x, inty) {
    Syst em.o u t. println( x+y);  } 
}

Isn 't  Taske r. cal c a  simi l ar i nstanc e of Cal c?
Ho w  is System.out not a NullPoi n te r E xc e ptio n?To be clear , th i s is  not aque s tionabout  N u ll P ointerException...th is isa que stion about w hy System. o u t  doesn't  req u ir e  initializatio n.
Th anks a bun c h!

A:
Why d oesn't S ystem.out r equire i nit ial isa tio n ?  Well...
Deepi n side  t he Syst emclass,the re' s a  me th od called  initial iz eS ys te mCl ass w h ich theJV M c al ls.  It s e ts Sys tem.o ut t oth e  ri ght val u e, s o yo udo n'thav eto.
N otet hat  System .out is N OTa n in st an ce of P rintStream -it 's a REFER EN CEto ani n stance o f PrintStream.

 Q:

Yo u  better  ke ep me  cle an, or yo u m ight c ont r act anastyfacul ta tiv e paras i t e
Th is  one is go i n g t o betr icky :

Ther e is a famous band wit h my name init. 
You b et ter ke e p m ec lea n ,  or you might c ontract ana s ty  facultati v e p ar asite.I comein ma n y shape s and siz es.
I hav ebeen f eat ured in th e backgr ound of a pic o n  c harli e_s wags i ns tag ram.You ca n  pu t mealmost  a nywher e.
Pe op le negle ct to use me when theythinktheyare  too cool  fo r  me .

A:

Ar e yo u annn...
 A irCondi tio n er

M y re a so nin g :

 B and: 

I have_added an_id in your <a>_tag 
Please_see_working example_below
$(document).ready(function()
{_  
_  _$('#button').click(function() {
  _  __     event.preventDefault();
        __ _alert("click_step2");

_   });
});

https://jsfiddle.net/fdzxLydg/

 Q:

invoking_method via reference variable

I'm trying_to understand_how System.out can invoke println(). All the searches__say System.out is_an instance of PrintStream class therefore it can invoke_a method in that class.
BUT...
When I_try to duplicate_this_with_the following a NullPointerException_results.
public class Main {
  _ public static void main(String[] args){
_      _Tasker.calc.add(1, 2);
    }
}

class_Tasker{
    static_Calc calc;
}

class_Calc {
   _public void add(int_x, int_y){
  _     System.out.println(x+y);
_  _}
}

Isn't Tasker.calc a similar instance of_Calc?
How_is System.out not_a_NullPointerException?
To_be clear,_this is not_a_question about_NullPointerException..._this is a question about why_System.out_doesn't require initialization.
Thanks a bunch!

A:

Why doesn't System.out_require initialisation?  Well...
Deep_inside_the System class, there's_a method called initializeSystemClass which_the JVM calls. It sets System.out_to the_right value,_so you don't have to.
Note that System.out is NOT an instance_of PrintStream - it's a REFERENCE_to an instance of_PrintStream.

 Q:

You_better_keep me clean,_or_you might_contract a nasty facultative parasite

This one is_going to_be tricky:

There is a famous band_with my name in_it.
You_better keep me clean, or you_might contract a nasty facultative parasite.
I_come in many shapes and_sizes.
I_have_been featured in the background_of a pic on charlie_swags instagram.
You_can put me_almost anywhere.
People neglect to use me when_they_think they are too cool for_me.

A:

Are_you annn...

 Air Conditioner

My reasoning:

 Band: