会java不会C#,或者会C#不会java?没关系,这里有对比。。。
看一下hello world的对比先。。
Java代码
- package hello;
- public class HelloWorld {
- public static void main(String[] args) {
- String name = "Java";
- // See if an argument was passed from the command line
- if (args.length == 1)
- name = args[0];
- System.out.println("Hello, " + name + "!");
- }
- }
C#呢?
C#代码
- using System;
- namespace Hello {
- public class HelloWorld {
- public static void Main(string[] args) {
- string name = "C#";
- // See if an argument was passed from the command line
- if (args.Length == 1)
- name = args[0];
- Console.WriteLine("Hello, " + name + "!");
- }
- }
- }
是不是很像吗?这里还有更多。。。http://www.harding.edu/fmccown/java_csharp_comparison.html。嗯,官方是这么说的:
XML/HTML代码
- This is a quick reference guide to highlight some key syntactical differences between Java and C#.
- This is not a complete overview of either language. Hope you find this useful!
除了这两种语言的对比,该页还有一个链接,是VB.net与C#的对比,对于只会vb.net的人来说,又是一个学习的途径啊。VB.NET and C# Comparison.