//it will work for global declaration

String a = "aaa", b = "bbb";//default declaration not local variables

public static void main(String[] args) {

  dummy d=new dummy();
     System.out.println("Before swap "
                + "a = " + d.a
                + " b = " + d.b);
        d.swap();
        System.out.println("After swap "
                + "a = " + d.a
                + " b = " + d.b);
 }
 void swap(){
        String temp = this.a;
       this.a = this.b;
        this.b = temp;
    }


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to