Title: In the process of doing our team project (game development), we used the C # programming language, and found that it looked very similar to Java, so I wanted to get a closer look at what the similarities and differences between Java and C # really are.
First attached to the Wiki encyclopedia "http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java" inside the more comprehensive content, although many can not understand, do not understand.
Here are some of my own understanding:
1. a class file in Java can have only one public class, and the class name must be the same as the file name, but there is no such restriction in C #, a file can have more than one public class, and a class can be scattered across multiple files.
Java's class methods generally start with lowercase letters, whereas C # 's class methods generally start with uppercase letters.
2, Java and C # operators are basically the same, but Java more than a bitwise operator >>> Right shift, left empty bits filled with 0
3 , Flow programmed Value Java and C # are basically the same, and the only difference is that they are written in a diachronic way:
java:for (int i:numarray) C #: foreach (int i in Numarray)
4, in the attribute, Java definition and access to use get and set method, you can not appear.
C # is a real property, and when defined, get and set must appear at the same time, accessed with a. Number. No get,set.
5, Java and C # inheritance and interface implementation mechanism is the same, both can only be single-inheritance, the implementation of multiple interfaces.
6. The inner class of Java can access the instance members of the external class directly.
C # is no good. The inner class of C # is equivalent to the static inner class of java.
Third week homework