using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HelloACCP
{
class Program
{
static void Main(string[] args)
{
int num1 = 1;
int num2 = 2;
Console.WriteLine("第一个数是{0},第二个数是{1}.",num1,num2);
swap(ref num1, ref num2);
Console.WriteLine("第一个数是{0},第二个数是{1}.", num1, num2);
Console.ReadLine();
}
private static void swap(ref int num1, ref int num2)
{
int temp = num1;
num1 = num2;
num2 = temp;
}
}
}
在java里,是做不到这样的