Go: Details how to learn Java

Source: Internet
Author: User
Tags object serialization

Here is a detailed description of how to learn Java, if the landlord has patience, it is recommended to take a closer look ~

Learn a new knowledge, can not expect to read only one, or two books will be able to fully grasp. There is a need for a gradual reading process. I recommend the Java Series books published by OReilly.

Here I just want to add that a lot of people learn Java from the "Thinking in Java" This book, but I think this book is not suitable for beginners. I think the correct way to use the book should be as a supplementary reading. "Thinking in Java" is not a complete introduction of the entire Java system, but a kind of jumping writing method, is a kind of tips-like approach to a lot of Java knowledge points in-depth analysis and interpretation.

For beginners, it is best to find a Java primer book, but a more complete sequential introduction of Java syntax, object-oriented features, core class library and so on, while reading this book, you can simultaneously see "Thinking in Java", to deepen the understanding of Java and the use of principles, At the same time, we can fully understand the whole Java system.

For Java's introductory book, Cai recommends OReilly's "Exploring Java, 2nd Edition" or "Java in a nutshell,2nd Edition (for C + + backgrounds)" And I have not read these two books. In fact, I think the electronics industry publishing House "Java 2 programming detailed" or "Java 2 from the beginning to mastery" is very good.

Of all the Java books, in fact, the most useful, not O ' Reilly Java serials, the real most useful is the JDK documentation! Almost all of the knowledge you want to get in the documentation, the most important part of course is the Java Basic Library API documentation, is organized according to the package, for each class has a detailed explanation, its inheritance relationship, whether to implement an interface, It is often used in the context of all of its public properties and methods, the interpretation of each property, the meaning, the purpose of each method, the parameters of the call, the meaning of the parameter, the type of the return value, and the exception that the method might throw, and so on. In this way, all of the books on Java programming are simply using the more understandable language and good organization to introduce the use of some of the classes contained within a package in documentation. So original aim, if you have enough ability to learn the Java library directly through documentation, then basically you don't need to look at other books. In addition, documentation is also a programming prerequisite manual, my desktop has three documentation shortcuts, The documentation of the j2sdk1.4.1 documentation,servlet2.3 documentation and j2sdkee1.3.1 respectively. With this three documentation, no other books are needed.

For Java WEB Programming, the core is to be familiar with the HTTP protocol, this is not related to Java, after familiarity with the HTTP protocol, you need to familiarize yourself with the Java implementation of the HTTP protocol class library, the servlet API, so the most important thing is the servlet Api. Of course, for beginners, it is very difficult to learn web programming directly through the Servlet API, and I recommend O ' Reilly's Java Server Pages to learn Web programming.

EJB books, "Enterprise JavaBeans, 2nd Edition" is a very good book, EJB learning threshold is relatively high, the entry is difficult, but this book completely reduced the difficulty of learning, especially important is that EJB learning needs to combine an app The implementation of the server, so while learning the EJB, you must synchronize the learning of some kind of app Server, and this book related to the three books, respectively, weblogic6.1,websphere4.0 and JBoss3.0 above the example of the implementation of the book. It is true that there is both theory and practice. While learning EJBs, you can look at the side and do it, and EJB learning becomes easy.

But this book also has a problem, is the version is older, mainly talk about EJB1.1 specifications and part of the EJB2.0 norms. and Ed Roman wrote "Mastering EJB 2.0" This book is written according to EJB2.0 specifications, in layman's terms, covering all aspects of EJB programming, and there are many programming experience tips, is also learning EJB is one of the most recommended books.

If it is combined with Weblogic to learn the Java EE, the "Java EE application and bea Weblogic Server" is definitely the preferred reading, although the Weblogic6.0 is still worth buying, this book is the official BEA recommended textbook, the author is Bea's engineer. Now the Chinese version is everywhere. This book combines weblogic to introduce the development and deployment of various aspects of the Java EE technology on the WebLogic platform, and the practical guidance is very significant.

After mastering the basic knowledge of Java platform and the knowledge of EE, it is further to learn how to use Oo method to design software, then we must learn "design pattern". Sun has published a copy of the Java EE Core model, which is a must-have book for every architect who develops the software for the Enterprise platform. This book comprehensively introduces the various design patterns of the Java EE Architecture and is a must-read book for designers.

Java Learning Path (iii) process

Everyone's learning method is different, one's method is not suitable for another person, I can only talk about their own learning methods. Because I study Java is completely self-taught, never asked others, so the process of learning is basically completely self-groping out. I also do not know whether this method is a better method, can only provide a little reference for you.

The first step in learning Java is to install the JDK and write a Hello world. In fact, the JDK learning is not so simple, about the JDK has two problems is easy to always haunt the Java Programmer's Place: One is the classpath problem, in fact, in principle, is to understand how the JRE ClassLoader is loaded class Another problem is the package and import issues, how to find the classpath of the class. By figuring out these two questions, you're removing the biggest hurdle to learning Java and using the JDK. It is recommended to take a look at Sen Wang's "Deep Adventures in Java" and discuss these two issues in depth.

The second step is to learn the Java syntax. Java syntax is Class C + +, basically the mainstream programming language is not Class C, is the class C + +, there is nothing new, so the grammar of learning, probably half a day is enough. The only thing to note is that there are several key words that are not easy to figure out, public,protected,private,static, when to use, why to use, how to use, this may need someone to point out, I was completely self-figured out, took a long time. But then I saw the book "Thinking in Java", which was about these concepts.

The third step is to learn the characteristics of Java's object-oriented programming language. such as inheritance, constructors, abstract classes, interfaces, methods of polymorphism, overloading, overwriting, Java exception handling mechanism. For a person who does not have an object-oriented language background, I think this process takes a long time, because learning Java before the C + + experience, only C experience, I was about one months or so, just thoroughly put these concepts are clear, the book above the examples of repeated thinking, modify, try, The chapters of the content of the repeated look over, look at the past, see not more than 5 times, just thoroughly understand. But I think if there is a C + + experience, it should be two days enough time. So in this process, you can see more "thinking in Java" This book, the object-oriented explanation is very thorough. Unfortunately, I studied, and did not see the book, so I spent a lot of time, through their own attempts and try to learn.

The fourth step is to get familiar with Java's class libraries. Java's base Class library is actually the JDK installation directory under Jre\lib\rt.jar this package. Learning Basic Class Library is learning Rt.jar. There are very many classes in the base Class library. It is said that there are more than 3,000, I have not counted. But there are only 4 of us who really have the core,
java.lang.*;
java.io.*;
java.util.*;
java.sql.*;

The four-pack study, each package of learning can be written in a thick textbook, and O ' Reilly did do so. I think if the time is tight, it is impossible to learn by reading four books. I think the better way to learn is this:
The first thing to do is to read through the entire package framework, to understand the class,interface,exception of the entire packages, preferably to find articles that introduce the entire framework. The first few chapters of these specially introduced books should be the overall framework.

The grasp of the overall framework of the package is not to be familiar with the usage of each class, but to remember what properties and methods it has. I can't remember it. Instead, you need to know what kinds of classes are part of the package, what these classes are used for, and what functions the core classes are doing. I usually teach a package at a time, so it is not possible to describe the usage of each class in detail, but I have repeatedly stressed that I am telling you these packages not to tell you how the method of the class is called, nor do you want to remember the method invocation of the class, but rather you know what classes Java gives us. Each class is used in what circumstances, when I encounter problems, I know which class, or which combination of classes can solve my problem, that ' all! , as long as you know which class to use to complete your work, when we write the program specifically, it's enough. When coding, the specific method calls, is the side write code, side check documentation, all the things are in the documentation inside, do not require you must remember, the actual you also can not remember more than 3,000 classes of a total of nearly 100,000 method calls. Therefore, the grasp of the overall framework of each package becomes extremely important.

The fifth step, through the above study, if the study of a more solid, then lay the foundation of Java, the rest of the work is to clear the documentation inside, in addition to the above 4 packages of other useful classes. I believe that progress to this step, Java's self-learning ability has been cultivated, can be directly to learn the level of documentation. In addition to GUI programming, the other packages that will be useful in the JDK are these:
java.text.*;
java.net.*;
javax.naming.*;
These packages really use more than a few of the classes, only a few, so do not need to spend a lot of time.

Sixth step, Java Web programming
The core of Web programming is the HTTP protocol, the HTTP protocol and Java-independent, if not familiar with the HTTP protocol, although you can learn servlet/jsp programming, but not to extrapolate, follow realm. So the learning of HTTP protocol is necessary. If you are familiar with the HTTP protocol, but also have a good foundation of Java programming, Learning servlet/jsp is simply easy, I learned to use less than a week servlet/jsp, and then began to use JSP to do the project.

In Servlet/jsp's study, the documentation is still the servlet. The most commonly used classes of Servlet APIs are few and take less time to master. Read through all these classes and try to write a few more examples. The essence of servlet/jsp programming is to call these classes repeatedly to talk over the HTTP protocol between Web server and brower. In addition to the JSP, also need to be familiar with a number of commonly used JSP tags, the specific way to remember the words, temporary check just.

In addition, Java Web Programming learning focuses on Web application design patterns, how to conduct business logic analysis, and reasonable design, according to the MVC design pattern requirements, using servlet and JSP to complete different logic layer, Learn how to control and share data between Servlets and JSPs, and how Web application should be configured and deployed.

Seventh step, Java EE programming
The above learning process if it is more smooth, to this step, the difficulty is suddenly improved. Because the above knowledge content is only involved in one aspect, and like EJB,JMS,JTA, such as the core of the Java EE specification is often a combination of the use of a number of technologies, the crystallization, so it is difficult to grasp the larger.

First of all must learn good Jndi,jndi is the app server location server resources (EJB component, DATASOUCE,JMS) lookup method, if the Jndi is unfamiliar, ejb,jms these things almost can't learn to go on. Jndi is actually javax.naming.* this package, it is very simple to use. The difficulty lies in the configuration of the server resource file. For the configuration of server resource files, it is necessary to look at the specific document specification, such as the writing of Web. XML, Ejb-jar.xml and so on. For each of the different app servers, there are also your own service resource profiles that you need to be familiar with.

You can then learn JTA, primarily to understand JTA's approach to transaction control, and where to use JTA. Here is a simple example, we know that the general situation can be used for a database connection transaction control (Conn.setautocommit (False),...., Conn.commit ()), as an atomic operation, But suppose my business requirement is to take operations on two different databases as an atomic operation, can you do that? At this time can only use JTA. Assuming that the operation is to first insert a record into a database, and then delete the B database another record, we write our own code is not control the entire operation as an atomic operation. With JTA, the app server is used to complete the control.

Learning about object serialization and Rmi,rmi is the basis of EJB before learning EJB. Following the study of JMS and EJB, the most important thing for EJBS is to understand how EJBS implement calls to remote objects through RMI, and under what circumstances EJB is used.

After learning to ejb,jms these things, you may realize that you are impatient to learn two areas of knowledge, one is UML, the other is design Pattern. Java enterprise Software Design attaches great importance to the design of the framework (framework), a good software framework is the prerequisite for the success of software development. At this time, should begin to focus on the study of design patterns and framework learning, through learning and practical programming experience to master the EJB design patterns and the core model of the Java EE.

The Java EE specification inside, besides EJB,JMS,JTA,SERVLET/JSP,JDBC also has many many enterprise technology, here does not introduce each one.

There is also a new domain Web Services. Web Services also has nothing new, it is like a binder that can unify different services to provide a unified calling interface, as a user, I just get the service provider to my WSDL (description of the service), enough, I have no idea whether the services provided by the server provider are EJB components or. NET components, or what CORBA components, or any other implementations, I don't need to know. The greatest place in WEB services is the sharing of the entire Internet service through a unified service delivery and invocation, which is a very exciting technology area. Web services seem to have no good books at the moment, but they can be learned by looking up data on the web.

Java Learning Path (iv) method

Java as a programming language, the best way to learn is to write code. When you learn a class, you can write a simple example of the program to run, see what results, and then call a few more classes of methods, see the results of the operation, so very intuitive to the class to learn, and memory is very deep. Then you should not be satisfied to put the code to pass, you should think about if I do not write this, another way, try again trial not. Remember which tall man said that learning programming is a destructive process, the book examples, their own learning documentation written examples in the run through, and constantly try to use different methods to achieve, and constantly try to destroy the structure of the code, see what the results. In this way, you will be thoroughly proficient in mastering Java.

For example, we've all compiled Hello world.

public class HelloWorld {
public static void Main (string[] args) {
System.out.println ("Hello World");
}
}

Many beginners do not understand why the main method must define public static void main (string[] args), can not write this? Including when I was just studying Java, there was this kind of doubt. Do you want to know the answer? Very simple, you have to change the main name to run, to see what errors, and then based on the error message analysis, the main public to take off, in the try, report what error, static remove can not run, do not know whether the main method must pass a string[] array, String[], change to int[], or string to try, do not know whether to write the args parameter name, you can also change the args to another name, see how the results of the operation.

I did this when I learned Java, the Hello World program repeatedly changed seven or eight times, constantly running, analysis of running results, finally thoroughly understand why the main method is so defined.

In addition, I do not understand the staic,public,private,exception,try{}catch {}finally{} and so on, and so on, all the examples of reference books run successfully, and then began to destroy it, Constantly according to their own heart of the question to rewrite the program, to see if it can run, run out what it looks like, whether you can get the expected results. This is a time-consuming process, but one example of this is repeated destruction several times. I have learned a thorough knowledge of the relevant information. Sometimes it is even intentional to write some wrong code to run and see if you can get the expected run error. So the mastery of programming is profound.

It is particularly noteworthy that the JDK has a very good debugging function,-verbose
Java–verbose
Javac–verbose and many other JDK tools have this option
-verbose can show how the JVM loads the class in sequence as the command executes, and with these valuable debugging information, it helps us to analyze what the JVM has done in the course of execution.

In addition, in the course of their own learning, write a lot of this destruction routine, should have the consciousness of the categories of preservation, in the work of the accumulation of typical routines should also be regularly collated, accumulate, and have a code base. In the case of similar problems, it is good to Copy & Paste, Search & Replace in the code base, greatly improving the development speed. Ideally, some of the general routines themselves can be abstracted to form a common class library, which is packaged well. Then reusability is even stronger.

So I think it is not particularly need routines, the destruction of their own routines is the best example, if you really do not worry about the code you write, I highly recommend you look at the JDK base Class library Java source code. Under the JDK installation directory there will be a src.zip, to be able to fully see the entire JDK base Class library, that is, Rt.jar Java source code, you can refer to how Sun wrote Java program, specification is what it looks like. When I am learning Java library, when some places do not understand very clearly, or want to understand the details of the operation more clearly, often open the source code of the corresponding class, by looking at the source code, all the problems will be swept away.

Java Learning Path (v) Resource Chapter

1.http://java.sun.com/English
Sun's Java Web site is a place that should often be seen. Don't say much.

2.http://www-900.ibm.com/developerWorks/cn/
IBM's Developerworks website, English good directly to the English main site to see. This is not only a very good object-oriented analysis of the design of the site, but also the Web services,java,linux excellent site. Highly Recommended!!!

3.http://www.javaworld.com/English
Discussion and news about many new technologies in Java. It's good to know more about the application of Java in every aspect.

4.http://dev2dev.bea.com.cn/index.jsp
Bea's developer corner, Bea, as the most important app server vendor, has a lot of unique technology, not to be missed on the WebLogic development of friends.

5.http://www.huihoo.com/
Gray Fox Power website, a professional middleware web site, although not a professional Java Web site, but in the EE enterprise application technology has deep attainments.

6.http://www.theserverside.com/home/English
Theserverside is a well-known web site specifically for Java server-side applications.

7.http://www.javaresearch.org/
Java Research Organization, there are a lot of excellent Java aspects of articles and tutorials, especially in the jdo aspect of the article is more rich.

8.http://www.cnjsp.org/
JSP technology website, there are quite a lot of Java aspects of articles and resources.

9.http://www.jdon.com/
Jdon Forum, is a personal nature of the Chinese Java EE Professional Technology Forum, in many of the Chinese forum, Jdon a very high technical content, the quality of the post is very good forum.

10.http://sourceforge.net/
Sourgeforge is an open source software stronghold, which also has a very very rich Java Open Source code of well-known software.

Resources:http://www.itpub.net/showthread.php?threadid=159803&pagenumber=
Resources:http://zhidao.baidu.com/question/751730.html

Go: Details how to learn 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.