Let's talk about how C # developers transition to JAVA developers,

Source: Internet
Author: User

Let's talk about how C # developers transition to JAVA developers,

If a language has been playing for a long time, I can't say that I am proficient in a language. If I assemble my head, Zhao's brother-in-law is a great cow. I am just a fan.

Back to the question, there have been countless posts on NET and JAVA in the garden. Here I just want to talk about some of the feelings about Csharper's conversion to Javaer. I have no intention of evaluating the advantages and disadvantages of the language. We are not qualified.

1. IDE

VS is the first IDE in the universe. This is indisputable. Although Eclipse is a little weak, it has done a good job.

Compared with VS, Eclipse is much smaller than 300G. I use Eclipse of the J2EE version. After decompression, it will be M + and no installation is required.

Of course, VS is huge, but it has unparalleled advantages in improving development efficiency.

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

In this Code, I entered a single character in Eclipse. for VS, after the for command is completed, you can click the Tab twice.

Of course, in code refactoring, Eclipse has more available operations than native. (If VS2015 is used, refactoring is awesome, and ReSharp is an attachment)

IDE is a one-minute function. Eclipse is a kind of torment for students with faster brains. If you have a Java expert, please refer to how to speed up.

In addition, the default font of Eclipse is unfriendly to Chinese characters, while VS is much better.

2. Generic

Generics are a slot of Java. Erased to kill people.

If you find any of the following technical problems wrong, please be sure to point them out.

C #'s generics generate different new anonymous classes based on different type parameters. Java is only a compilation phase and pretends to have the concept of generics.

    ArrayList<Integer> c = new  ArrayList<Integer>();    c.remove(1);    c.remove((Object)1);

Now let's focus on the above Code.

If a list is used to delete an element, C # will have a Remove and a RemoveAt. The former indicates to delete the specified element, and the latter indicates to delete the element of the specified underlying object.

Then, if you write c. remove (1) in the Code, the Java action is to delete the element whose subscript is 1 ..

The main problem here is that at the beginning of Java's design, there was no difference between RemoveAt and Remove because the two requirements were not taken into account through subscript deletion or direct deletion.

Of course, this will lead to differences when removing (Integer). In order to eliminate ambiguity, You Need To forcibly convert Integer or other generic types into objects.

In C #, because of the RemoveAt method and complete generic support, the Remove Method is followed by what you want to Remove. Here is a note.

3 basic type

            int a = 1;            Int32 b = 2;

Int and Int32, which are of the same type in C # (of course, they are all value types and saved on the stack)

C # Via CLR also mentioned this. int Is the alias of Int32. (If this idea is wrong, I hope you can point it out)

            List<int> t = new List<int>();            List<Int32> m = new List<int>();

Therefore, you can write in C.

 

In Java, int and Integer are distinct:

Int indicates the base type and Integer indicates the class. Only Integer can be used in the generic type.

I am not very clear about the difference here. int seems to be a simple thing to store numbers, and there is no way to use it.

    ArrayList<Integer> c = new  ArrayList<Integer>();

Therefore, in Java, the type parameter T does not seem to be C # flexible.

 

4. Java has no Struct Concept

Essentially, the Class and Struct are similar in terms of business. Only the Class is on the stack, and the Struct is on the stack. One is reference transfer and the other is value transfer.

In general, a light structure, anemia model, I like to use Struct, a heavy structure, a congestion model, and I like to use Class.

Java. Sorry, there is no Struct. The solution is Class or internal Class ..

I don't know why Struct cannot be implemented in Java, whether it is design or technical problems.

 

5. Java Enumeration

This is not a question about Java enumeration, but an Enum player that depends on the JDK version.

JDK and later are supported. If your project JDK version is too low, Enum does not support it.

C # The Enum in it should be supported by the full Framework. (currently, no frameworks earlier than NET2.0 can be found, and 1.0 and 1.1 cannot be verified. It is supported in memory .)

Why did we talk about this problem? I once started an experiment with students. I created a new project in Eclipse and didn't select the JDK version. I used the default lower version of JDK,

Enum cannot be compiled. Learning is not refined...

The value of Enum is essentially a number, while Enum is a structure. What is Java's Enum?

6. String

 

            String A = "Hello";            String B = "Hello";            System.Console.WriteLine(A == B);            System.Console.ReadLine();

 

C # is True. Java is also True.

(In Java, the addresses of A and B point to the same place? C # the string is resident .)

 

            String a = new string('a', 10);            String b = new string('a', 10);            Console.WriteLine(a == b);            Console.ReadLine();

This is also True in C #. Compare the address. Because of the mysterious String resident mechanism of NET, the two strings actually point to the same place.

 

String A = new String("Hello");String B = new String("Hello");Boolean C = (A==B);

Here is False. Java actually compares two addresses, which are different. For comparison, use methods such as Boolean C = (A. equals (B.

Who is talking about the Java string mechanism.

 

7. Market and Future

I have done a lot of human resources work, and I feel that NET has no Java fire in China.

In Japan, NET has projects, but most of them are Java.

NET and Java have almost the same number of top experts, but Java accounts for a majority of middle-and low-level students. The reason is that they are needed for employment.

NET and Java should be very skillful, algorithm business is the focus, and language is just a tool.

 

Do not discuss the quality of language in the reply. We are not qualified.

You are welcome to point out technical problems and hard injuries, or add some differences that I have not listed.

 

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.