Talk about how C # developers transition to Java developers

Source: Internet
Author: User

Because of the work needs, recently began to Daoteng Java. NET, from the 2012 beta began to play, that time VB6 more familiar, but also naïve thought vb.net will be very fire,

It turns out, it is only wishful thinking, there is C #, what to VB.net to do? Both raw yoga, Sheng ...

A language to play for a long time, also can not say to a language proficient, assembly head, Zhao brother-in-law is Daniel. I'm just a fan.

Say back to the point, the garden inside net and Java good or bad posts have been countless, here just want to say Csharper turn javaer some feelings, no intention to evaluate the merits of the language, we do not qualify.

1.IDE

VS is the universe's first IDE, this is indisputable, although the eclipse is somewhat weak, but also did well.

Compared to the 8, 9 g of the body, Eclipse is much smaller, I use the Java version of Eclipse, after decompression 300m+, free installation.

Of course, vs is huge, but to improve development efficiency, there is an unparalleled advantage.

     for (int i=0;i<5;i++) {            }

Such code, I am in Eclipse is a character input of a character, vs words, after playing for, two tabs will be.

Of course, in code refactoring here, Eclipse has a lot more to do than native vs. (VS2015 words, refactoring is also very good, resharp possession of the feeling)

IDE, or the size of a function, for the brain than deft on hand students, Eclipse is a kind of torture. If you have a master of Java, ask how to speed up.

Another point, Eclipse's default font, is unfriendly to Chinese, vs is much better.

2. Generics

Generics are a slot point in Java. Wiping division kills people.

The following technical questions, if there is a place to feel wrong, please be sure to point out.

C # Generics, depending on the type parameters, produce different new anonymous classes, Java is just the compilation phase, pretending to have the concept of generics.

    New  Arraylist<integer>();    C.remove (1);    C.remove ((Object)1);

Now concentrate on the above piece of code.

A list of words, delete elements, C # will have a remove and a removeat, the former means to delete the specified element, which represents the deletion of the specified subscript element.

Then, if you write in the code c.remove (1); The Java action is to delete the element labeled 1.

The main problem here is that when Java was designed, it did not take into account the deletion or deletion of the two requirements by subscript, so the removeat and remove were not distinguished.

Of course, this causes the Remove (integer) when there is a discrepancy, in order to eliminate ambiguity, but also need to cast an Integer or other generic type to object.

In C #, because of the RemoveAt method, the complete generic support, so the Remove method followed directly to remove the thing can be, here is a point to note.

3 Basic Types

            int 1 ;             2;

int and Int32, in C # are the same type (of course, are value types, stored on the stack)

C # Via The CLR also said this thing, int is the alias of Int32. (If the idea is wrong, I want you to point it out)

            list<intnew list<int>();            Listnew list<int> ();

So it's possible to write this in C #.

In Java, int and Integer are distinct:

int represents the underlying type, and integer denotes the class, which can only be used with integers when generics.

The difference here is not clear to me, int seems to be a simple thing to store numbers, and there is no way to use them.

    New  Arraylist<integer> ();

So, in Java, the type parameter T does not look as flexible as C #.

4.Java no struct concept

In essence, class and struct are similar in business. Just class on the heap, struct on the stack, one is the reference pass, and the other is the value pass.

Generally speaking, a light structure, anemia model, I like to use a struct, a heavy structure, a congestion model, I like to use class.

Java, I'm sorry, there is no struct, the solution is class, or the internal class.

I don't know why structs can't be implemented in Java, either by design or by technical issues.

Enumeration of 5.Java

This is not a problem with the Java enumeration function, but rather, the enum is dependent on the JDK version.

JDK1.5 above, if your project JDK version is too low, enum is not supported.

The enum in C # should be supported by the whole framework, which cannot now be found in the previous framework of NET2.0, and cannot verify 1.0, 1.1, which is supported in memory. )

Why do you talk about this problem, one time with the students to do experiments, Eclipse built a new project, did not choose the JDK version, using the default version of the JDK, and then, hehe,

Enum is such a simple thing, all compiled but. The Apprentice is not fine ...

The value of an enum is essentially a number, and an enum is a struct, what is the enum for Java?

6. String

            " Hello " ;             " Hello " ;             = = B);            System.Console.ReadLine ();

C # inside is true. Inside Java is also true.

(The addresses in Java A and B point to the same place?) The C # string resides. )

            New string ('a');             New string ('a');             = = b);            Console.ReadLine ();

This is also true in C #, compared to the address, because of the mysterious string-resident mechanism of net, in fact two string points to the same place.

New String ("Hello"new string ("Hello"= (a==b);

Here is False,java really compares two addresses, two addresses are different. If you really want to compare, please use such as Boolean C = (a.equals (B)); Such a method.

Who would say the Java string mechanism.

7. Market and future

Do a lot of human resources work, feel net in the domestic no Java fire.

In Japan, net has projects, but most of them are java.

NET and Java have the same number of top players, but the low-level, Java-dominated, the reason for employment needs.

Real Masters, NET and Java should be very skilled, algorithmic business is the focus, language is just a tool.

Do not discuss the quality of the language in the reply, we do not qualify.

Please point out technical problems and mishap, or add some of the differences I have not enumerated.

Talk about how C # developers transition to Java developers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.