梦幻之旅

DEBUG - 天道酬勤

   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  671 随笔 :: 6 文章 :: 256 评论 :: 0 Trackbacks
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里,是做不到这样的
posted on 2011-07-13 01:25 HUIKK 阅读(296) 评论(0)  编辑  收藏 所属分类: C#

只有注册用户登录后才能发表评论。


网站导航: