Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Bill Howell   on Nov 09 In Java Category.

  
Question Answered By: Scott Simmons   on Nov 09

class test
{
public void swap(int x,int y)
{
int temp;
temp=x;
x=y;
y=temp;
}

public static void main(String args[])
{
test t1=new test();
int a=10;
int b=20;
t1.sawp(a,b);
System.out.print(a);//will not change print 10
System.out.print(b);//will not change print 20
}

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Passing Or get search suggestion and latest updates.


Tagged: