On Apr 22, 12:20 pm, malti sharma <[email protected]> wrote:
> hi
> *
>
> public* *class* SweepMethod
>
> {
>
> *public* *static* *void* main(String[] args)
>
> {
>
> *int* a;
>
> *int* b;
>
> a = Integer.*parseInt*(args[0]);
>
> b = Integer.*parseInt*(args[1]);
>
> System.*out*.println("Value in Main Method :"+a);
>
> System.*out*.println("Value in Main Method :"+b);
>
> *sweepValue*(a,b);
>
> }
>
> *static* *void* sweepValue(*int* a,*int* b)
>
> {
>
> *int* c;
>
> c=a;
>
> a=b;
>
> b=c;
>
> System.*out*.println("Value in sweepValue Method :"+a);
>
> System.*out*.println("Value in sweepValue Method :"+b);
>
>
>
>
>
> }
> }
This does not solve the problem. You merely print the swapped values
inside the sweepValue method, but the values in main are not changed.
The change is just local to the sweepValue method.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---