代码改变世界

代码从"hello world"开始...

2005-05-16 21:36  稻草人  阅读(643)  评论(0)    收藏  举报

 

那天无聊从网上DOWNLOAD了几个简单的代码,随便看看,没想到就一个hello world就可以写得这样"面目全非",忍不住放到blogs上面大家慢慢看,以做日后学习之用
 第一种:
public class Hello1
{
   
public static void Main()
   
{
      System.Console.WriteLine(
"Hello, World!");
   }

}

第二种:
using System;

public class Hello2
{
   
public static void Main()
   
{
      Console.WriteLine(
"Hello, World!");
   }

}

第三种:
using System;

public class Hello3
{
   
public static void Main(string[] args)
   
{
      Console.WriteLine(
"Hello, World!");
      Console.WriteLine(
"You entered the following {0} command line arguments:",
         args.Length );
      
for (int i=0; i < args.Length; i++)
      
{
         Console.WriteLine(
"{0}", args[i]); 
      }

   }

}

第四种:
using System;

public class Hello4
{
   
public static int Main(string[] args)
   
{
      Console.WriteLine(
"Hello, World!");
      
return 0;
   }

}

虽然实现在结果都不是完全一样,但效果一样,我想这是学习过程中的一点感悟,活学活用