Often people ask this question, after using some time Java, found that the two things in addition to a small number of shell length can slightly make up, basically no similarities, can be said to be similar on the vest level, or relatively short vest ...
General C # for the development of business systems, rapid implementation, Microsoft's official packaging, a variety of syntactic sugar, so that C # in the semantic grammar level more humane, the development of ideas more focused on business logic, the implementation of the technology does not need to care very thin (of course, this refers to the initial level of entry), but also bring some defects, When the surface of the effort is not enough,. NET programmers have to understand what Microsoft encapsulates, so I know a. NET programmer with almost a single anti-compiler, fortunately Microsoft almost never confuse the code ... This aspect of Java is just the opposite, the semantics of the individual time is somewhat awkward, and the technical implementation needs a certain concern, re-learn the data structure is not said, and now even linear algebra began to re-learn, some algorithms really do not learn to understand, but Java also from another aspect of the technology to reduce the threshold, Java has a large number of open source frameworks thanks to a full suite of EE specifications, which, as long as they follow the rules, can easily be used by programmers to reduce their workload. NET now also began to work in this area, but only now see the Owin norms, but also completely fragmented.
Then say the execution of the program: the execution of the. NET program is in the assembly, only the loader of the assembly, the loading process refers to my previous essay, so there is a friend this way of controlling access, the class is loaded when the assembly is loaded, like the class cannot find the exception is in the assembly load times, C # The reflection is also started from the assembly, the process can refer to: https://msdn.microsoft.com/zh-cn/library/ The execution of F7ykdhsy.aspx;java is in class, the load byte stream to the method area, connection, validation, preparation, parsing, until the initialization of a series of processes, only execute to need this class to load it, can not find the class exception is used in the actual use of the report, Java reflection Performance, although because it includes a Some dynamic type JVMs are not optimized for this code, but the actual full loading process is almost the same as the normal new loading process, and the difference may be just a few steps apart ... , as for "because reflection allows code to perform operations that are not allowed under normal circumstances (such as accessing private properties and methods), using reflection can lead to unintended side effects-code has a functional error and reduces portability." The reflection code destroys abstraction, so when the platform changes, the behavior of the code is likely to change as well. "That's the same situation. Each Java process starts with a JVM instance that executes, the JVM exits when the program executes, and. NET is isolated by the CLR that loads the assembly in an application domain. It's all about using an instant compiler to execute the results.
At the compiler level, one is the bytecode instruction, the other is the Il intermediate language, IL as the intermediate language will be more powerful, such as support more inheritance what what, at this level. NET based on CPU architecture and so on some code optimization, in addition. NET AOP is also based on IL.
Garbage collection: In general, garbage collection is generational, but Java's incremental recovery also has a pure by slot, the way of generational is slightly different, because the CLR header has metadata exists not like Java, but also need method area, so. NET has 0,1,2 three generations, and the JVM has only young and old plus a method area. Recycling algorithms and customisation on the one as far as possible to open one as close as possible. NET seems to provide only the workstation or server mode option, which is based on the root of the reference trace, the size of the three generations. NET automatically adjusts according to the current mode and the frequency of recovery, have to say that compared to Java to do a variety of JVM tuning is saved more, big object is directly into the last generation, 85000;java's recovery algorithm has reference calculator, tag, copy, Tag-copy mixing and other optional self-matching, can be divided into select parallel or concurrent recovery, you can adjust the size of each generation scale, can also adjust the size of E, how many s area, a variety of practical proportions, the size of the method area, and so on, on the line sometimes you need to view some memory by command and tuning the various parameters Such a huge piece of content. NET is fully automatic, basically want to tune there is no way to adjust.
Exception handling: Exception handling, one is Java has the error of this kind of thing, in addition to Java code in the possible exception of the part of the need to be explicitly processed or thrown.
Multithreading: Syntax relative to Java compared to native bar,. NET is basically now a form of task, such as latching on to something like this. NET shows as Taskfactory.continuewhenall this kind, the difference is very big, does not enumerate: NET has commissioned this structure also does not need runable, can be canceled on both sides is similar, as for the return value, that is, the implementation of a slightly different way to say. Thread pool, Java executor provides a powerful and rich thread pool available, the thread pool can also be instantiated for use; the. NET thread pool is not used directly, and this is a CLR-level unique pool, meaning that all applications on this version of the CLR are common to this pool, Maybe you split the size of 100 threads, you don't get one, and now the official seems to only limitedconcurrencyleveltaskscheduler can safely act as a thread pool to use. In addition, for example, long in C # is non-thread-safe in 32-bit systems, but thread-safe in 64-bit, Java is thread-insecure, because Java stacks are 32-bit, the JVM will divide long into 32-bit and low 32-bit, double the same.
Generic aspects forget where to read a blog that generics and object-oriented conflict, the author is not expected to contact the C # (it seems that Scala also support, but I do not know) of the inverse and covariance, more fine find a blog said in detail, I will not copy the http://blog.csdn.net/nabila/ article/details/8133245
Above is I think more typical difference, I touch Java time is not long, recently also in constantly reading, I will promptly add, but again how to say this is a generalization, and can not be very fine, meticulous part of me is also tidy up some, but more chaotic, and so I go further and then go back to tidy up again ...
References in addition to the links in the essay include:
Http://wayneye.com/Blog/Atomic-Operation-In-Csharp
The difference between C # and Java