How does a. NET programmer go to Java?

Source: Internet
Author: User
Tags reflection

First of all, big guy, please ignore my article, I am a 5-year-old pure C # developer, I am here to record only the process of my turn to Java. all know that Java is open source, so it has many development tools, unlike. NET, the most direct surface of the IDE. Like now the most popular is IntelliJ idea, the last few years used to be eclipse and myeclipse, but I follow the public's original intention, is from eclipse. I didn't mean to know how this tool is, first I understand how it creates a project, starting with System.out.println first. At this point, the first Java Hello Word comes out.

First, the Java Foundation

In the beginning, I took three days to see the grammar inside it (the total time estimate is about 10 hours), mainly to watch the video. I focus on the collection, inheritance, generics, reflection, etc., because before the foundation of. NET, so the feeling is very much the same, a lot of direct neglect, just record some special grammar. I find that Java and. NET differ in that one Java file cannot have two non-intrinsic classes at the same time, but. NET can be, and inheritance keywords are different. NET is used:, and Java is used extends, and the implementation of the interface, need to use implements; There are also some reflection keywords that are different. Three common ways to get objects:

1. Instance object, directly with GetClass ();

2. Use class classes directly;

3. Use Class.forName ("package name. Class name"); Also, collections: like Colletion and map, it contains subclasses that must be memorized in the heart, so that the interview has confidence. These are the basis of Java, must be as familiar as possible to master;

Second, the database connection

Next, a short period of time, I appeared confused, basic I understand, but do not know how to start to the web, and then I have been sorting out their own learning ideas (here would like to spend a mind map, but did not draw). I am not eager to learn the framework, I start with the connection database, I first download the corresponding version of the MySQL database driver, database connection based on the following several steps:

1. Read the configuration file (file contains: Driver (driver), url (MySQL driver, remember, here is the best suffix plus SSL configuration and transcoding mechanism), user and password separate database account and password); Here you can also write directly in the Java file, Not necessarily in the configuration file.

2. Load the drive with Class,forname

3. Accept Drivermanager.getconnection (Url,user,password) with Connetion object;

At this point, the database connection is successful;

Third, Servlet and JSP learning;

At first, I confused the two, and I thought, like. NET MVC, that the controller corresponds to the corresponding page, however, I was wrong. But they have the similarities, the Microsoft's MVC know, controller inside can according to method, in your return view () does not specify the corresponding page, is to return to the corresponding page of the same name; And the servlet is different, it inherits with the HttpServlet, the following collation design to the knowledge point:

1. To understand the basic syntactic sugars of servlets and JSPs, into <%%>,<%=%> and include directives and behaviors, etc...

2. Learn about the values of Servlets and JSPs. What I am currently mastering is the use of Request.setattribute to act, and then to use Request.getrequestdispatcher ("index.jsp"). Forward ( request, response); To index.jsp page, accept, Request.getattribute to receive. Of course, this is just a simple example, and there are other things to find out.

3. Some session caches and so on.

In combination with the above, I have removed the basic elements of Java. I didn't say to see how the JVM is optimized and how it works, and those are the future I'm going to get to know. Now it's just beginning to teach yourself, and then what you need to learn is how to deploy a project on a Linux system, how to build a publishing project, and so on. My language ability is limited, this caught dead only.

  

How does a. NET programmer go to Java?

Related Article

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.