Interchange two values with third variable
- Make new jFrame and add the components to frame like given in below figure.
- Open source code and declear three variables a,b,c as integer and also type the code of text fields.
- Type the code given below
- Now I will explain how java interchanges the value:
- Let a=10,b=20,c=0.
- Here c=a means c=10.
- Now a=0.
- Then a=b means a=20.
- Now b=0.
- Then b=c means b=10.
- So by this java interchanges the value.
- Now print a & b.
- Run the file and see what happens.
No comments:
Post a Comment