手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表Tag:c#

Java and C# Comparison

会java不会C#,或者会C#不会java?没关系,这里有对比。。。
看一下hello world的对比先。。

Java代码
  1. package hello;  
  2.   
  3. public class HelloWorld {  
  4.    public static void main(String[] args) {  
  5.       String name = "Java";  
  6.   
  7.       // See if an argument was passed from the command line  
  8.       if (args.length == 1)  
  9.          name = args[0];  
  10.   
  11.       System.out.println("Hello, " + name + "!");  
  12.     }  
  13. }   

C#呢?

C#代码
  1. using System;  
  2.   
  3. namespace Hello {  
  4.    public class HelloWorld {  
  5.       public static void Main(string[] args) {  
  6.          string name = "C#";  
  7.   
  8.          // See if an argument was passed from the command line  
  9.          if (args.Length == 1)  
  10.             name = args[0];  
  11.   
  12.          Console.WriteLine("Hello, " + name + "!");  
  13.       }  
  14.    }  
  15. }   

是不是很像吗?这里还有更多。。。http://www.harding.edu/fmccown/java_csharp_comparison.html。嗯,官方是这么说的:

XML/HTML代码
  1. This is a quick reference guide to highlight some key syntactical differences between Java and C#.  
  2. This is not a complete overview of either language. Hope you find this useful!   

除了这两种语言的对比,该页还有一个链接,是VB.net与C#的对比,对于只会vb.net的人来说,又是一个学习的途径啊。VB.NET and C# Comparison.

Tags: java, c#, comparison