Java recommended readings and source code reading

Source: Internet
Author: User
Tags stmt java reference

Java recommended readings and source code reading
Jiangsu Wuxi Miuxiaodong

1. Java Language Basics
When it comes to basic Java language Learning books, you will definitely recommend Bruce Eckel's "Thinking in Java". It is a very profound technical book written, the basic part of the Java language is basically no other book can go beyond it. Bruce Eckel, the author of the book, is known as a genius speculator on the internet, and the author's thinking in C + + was softwaredevelopment Jolt Award Best Book Award in 1995, "Thinking in Java" Was named 1999 Java World "favorite readers Welcome book", and won the editor's preferred Book Award. Since 1986, the author has published more than 150 computer technology articles, published 6 books (4 of which are about C + +) and made hundreds of speeches around the world. He is the author of "Thinking in Java", "thinking in C + +", "C + + Inside & Out" Using C + + and "thinking in Patterns", as well as the "Black Belt C + +" anthology Edit. His book is known by readers as "The best Java reference book ... Absolutely shocking ";" the smartest choice to buy a Java reference book; "The best Programming Guide I've ever seen." The author's extraordinary talent, the ability to transcend language, has made the author one of the 10 most closely related Java development 10 years.

"Thinking in Java" covers every aspect of the Java language, and many veteran of the Java language evaluate "This is a very ugly book to speak the Java language." The book talks about the many details of the Java language, each of which is quite profound. Through this book you can see the "ugly" Java language.

There are a lot of videos on the web about the Java language, among which there is rubbish. "Onge-java language" may be your only choice to learn the basics of the Java language, the lecture is basically in accordance with the "Thinking in Java" This book, which is uncommon there are many interesting jokes Weng teacher. I was fortunate to learn to start with this video. The content includes 30, and I've seen it 3 times in total.

However, for beginners I do not recommend the use of "thinking in Java", I would recommend Prentice Hall PTR "core Java 2" in the domestic known as "Java 2 core technology", is currently the seventh edition. Everyone on the Web can download it to the electronic version. OReilly's "Java In a Nutshell" is also a good choice. After reading these two books, you can take a look at the Onge teacher's video, then you can study "thinking in Java".



2. Java Data structure
There are very few books on the market for Java data structures. Roughly apress "Java collections", Jones and Bartlett's "Data Structures in Java", "object-oriented data Structures Using Java" and PR "Data structures and Algorithms in Java" published by Entice Hall (Dec 19, 2005) is also the data structures and algorithms with object-or iented Design Patterns in Java. Luckily my first English book is Apress's "Java Collections" (This book may not have Chinese version at home at all-only download English version), very good, speak very regulation, very simple, is a completely Java Collections API introduction of the book , where there are examples of extended APIs. This is the only good book I recommend you to learn Java data structure. The other Jones and Bartlett of the two domestic seems to have a Chinese version, want to see you can also see.

After learning the API, you can look at the corresponding class in the Java.util package. But only after you have studied design patterns can you fully understand the entire Java collections Framework. The Java collections framework uses a number of well-known design patterns such as: iterator (Iterator) mode, factory method mode, adorner mode, adapter mode, and so on. By studying the source code of the data structures in the Java.util package, you can know the design of the infamous properties class and probably have the ability to design simple data structures.

The so-called learning endless, after studying sun provided the Java Collections Framework, you can study the Apche of another Java collections framework, very interesting oh. Two frameworks that complement each other.



Before you learn and study Java collections, I suggest that Java collections consists of three main parts: interface (Interface), implementation (Implemention), and Algorithm (algorithm).

1. The main interfaces are list, Set, queue, and Map. List, Se T, and queue are sub-interfaces of the collection interface.

2. Implementations are primarily specific classes that implement these interfaces. such as the implementation of the list interface ArrayList, LinkedList, Stack and vector, the implementation of the set interface HashSet, TreeSet and Linkedhashset, implementation of the queue interface Priorityqueue, Synchronousqueue, HashMap, TreeMap, Hashtable, Properties, Weakhashmap and so on, to implement the map interface.

3. The algorithm is mainly provided by the arrays class and the collections class, which is the core of the entire Java Collection framework algorithm. Support various types of sorting, find and other common operations.

Java collections contains two versions of the data structure, mainly the original data structures that support synchronization, and data structures that later do not support synchronization.

The Java Collection framework supports sorting using the comparator and comparable interfaces. Also available are new and old two versions of Iterators iterator and Enumeraton, and how they are converted and so on.

The Obserable interface and the Observer class in the Java.util package are the core of the explorer pattern.

......



3. Java IO
The book on the market for IO is only two copies of OReilly publishing house, both of which are Elliotte Rusty Harold's writings. The style of the two books is basically the same, recommended reading is the first version of the "Jvava I/o", speak relatively simple, relatively concentrated content, examples are also many. The second edition was published abroad this May, it is fortunate that I downloaded the second edition on the network, speak extremely detailed ――726 page of the big (I took two weeks), this will nio and IO and together, but also includes the J2ME part of, but the serial port, and the communication part of the port as if the class library support is not enough, I can't actually operate

With the first version of the "Jvava I/O" oreilly also has a "Jvava NIO", is also very good oh.

After reading "Jvava I/O" and "Jvava NIO" in turn, we can study the source code in the Java.io package. Before you look at the source code, I'll give you some hints:

The IO packages for Java mainly include:

1. Two streams: byte stream and character stream (character stream), these two streams do not exist so-called who replace who, who is higher than who said, they complement each other, but the focus is different.

2. Two kinds of symmetry: 1. Byte stream, character stream symmetry; 2. The symmetry of the input and output.

3. A bridge: Converts the byte stream into a inputstreamreader and outputstreamwriter of character streams.

One must note:

1. PipedInputStream and Pipedoutputstrem are two of the more interesting classes.

2. Streams that support buffered are classes that we use frequently.

3. The most famous application of the adorner (Decorator) mode in Java is the design for IO. Carefully study the relationship between each filter flow and the specific flow, and read more about the design patterns of the books. I'm sure you'll get what you've been given.

4. Learn Good IO package, is the research net package, RMI package ... Foundation of the Oh!



4. Java database
The database of books too many too many, is too rotten too bad! This aspect of the book I have basically studied, recommended you see Apress's "JDBC Recipes A Problem Solution approach" is very good, foreign 2005 at the end of the publication, (China seems to have no Chinese version, but out of the Chinese version is not necessarily worth watching- Domestic often translation of foreign books is a mess, offensive, but we are really lucky, the Internet has an electronic version. Worth a look. Recommended I see the first more satisfactory ――wiley published the "Java Database Bible", Speak very good! The "JDBC API Tutorial Andrefernece" that Sun's own introduction to the JDBC API is also good. My second JDBC is the set of APIs to study.

But at the moment these books are some of the more superficial API applications. I will give you the opportunity to introduce the JDBC API and the internal details of the JDBC implementation of the book! I hope to get the support of everyone!

By the way, a little hint to a friend who learns JDBC:

The learning and use of JDBC is primarily the set of APIs, and its use is extremely simple, following the general process of using JDBC:

1. Load a database driver (driver Class), usually using Class.forName ("Driver class name");

2. Connect to the database –

Connection con = drivermanager.getconnection (Url,username,password);

3. Get session ――statement stmt = Con.createstatement ();

4. Perform operation ――result rs = stmt.executequery ("SQL query statement");

5. Processing Results-

while (Rs.next ()) {

String col1 = rs.getstring (1);

......

}

It's simple! The general variation in the entire JDBC can be:

1. Three types of statement can be created by Connection object creation statement, PreparedStatement, and CallableStatement.

2. Multiple types of resultset can be created: one-way movement and one free movement, updatable and non-updatable, support for different levels of trading .....

3. Batch processing of data input.

4. Result sets the operation of special types (BLOBs, Clob, arrary, and ref, Struct) columns.

5. These special types of input databases.

6. Javax.sql the operation of the special result set (CachedRowSet, Jdbcrowset, Webrowset) in the package.

7. The other is a DataSource, also very simple! A managed object in a Java EE

It's simple! I'm sure you'll soon conquer JDBC.



5. Java Network Programming
Network Programming-a mysterious, challenging direction. But before talking about Java network programming, thank the developers of sun, because of their genius, the intelligent architecture, so that the vast number of Java Programmers Learning Java network programming becomes very simple.

Java Network Programming in the book, I recommend O ' Reilly's "Java Network Programming", is now the third edition, the previous version of the market must have! The Internet has a third edition of the electronic version, published in 2004 abroad, 706 pages Oh! Speaking very full, more in-depth, too deep may be due to sun some things are not completely public, so it is not good to talk about, interested can download to see! The second book is Still O ' Reilly 1998 published "Java Distributed Computing", the basic part is written in more detail, the following examples are worth studying.

Before you read these books, give us a hint:

Java network programming is relatively simple and quick to get started. Java network programming mainly consists of two parts: 1. Socket;2. The URL section. But the second part is entirely based on the first part.

1. The socket includes the client socket and server-side serversocket. There is also Datagramsocket and Datagrampacket, which corresponds to the UDP communication protocol. In summary, the socket section is the basis for other advanced protocols.

2. The URL class is a network resource locator, usually with specific network protocols such as Http,ftp,telnet ... Related. Through this class can connect the resources on the network, through its openstream can read the network resources in the form of the stream (InputStream) in the IO packet, through its OpenConnection method, can open a connection, on this connection can not only complete the read operation, You can also complete the write operation.

Java's network programming generally includes the above two parts. Network programming and IO and multi-threaded parts are very close, before you learn this part of the two must understand the more thorough.

Learn the above section you can study the java.net package in the relevant source code! The source code of the Institute is still too early. Included in the whole net package: ContentHandlerFactory, URLStreamHandlerFactory, URLStreamHandler, URLClassLoader and other auxiliary classes, They form the framework of java.net network programming, and by studying its source code, you can not only quickly understand the java.net package, but also lay the groundwork for extending the package later, and even apply it to your own projects.

So far, you should know about the java.net package. 60%, and part of it you can use anti-compilation software such as Jdecompiler to open your JDK installation directory \jdkxxx\jre\ Lib directory of Rt.jar, with software such as WinRAR open its sun.net package, decompile all the files, it is the URL class work details. When you're done studying the Sun.net package, you'll be familiar with the whole network programming.

Everything seems to be well versed in network programming. Actually, just started, want to go deeper, please continue! Many excellent network programming libraries and even software can "add skill" to us. such as Apache's Httpcore and Httpconnection are two and HTTP protocol related libraries, jgroups is the study of distributed communications, group communication must read the library, then we can study peer-to software packages, such as Sun Company's Jxta, It may be the standard for the future of point-to-point communication in the Java platform. Then you can study very mature and use a very wide range of peer-to azureus! software. Www.sourceforge.net can be downloaded to!

A journey begins! Just Do it! (I've only studied net packages at the moment, and others will continue to go deeper in the near future.) For some reason, Sun has no other implementation details of the public net, and when it allows its source code to be researched in the form of text, and to allow it to be written in an implementation that is not publicly available, I would like to write a book on Java Network programming to supper the vast readership!! )

6. Servlets and JSPs
The Servlet and JSP books are everywhere! It is worth recommending only two or three copies. Real Push Addison Wiley "Servlets and JavaServer pages:the java EE technology Web Tier", is a very thick oh! Published in 2003 abroad, 784 pages, speak more fully, examples are many, especially the eighth chapter filter, give a few good examples. All the other books I've seen about Servlets and JSPs are not so deep! (Maybe I didn't see it). O ' Reilly's Java Servlet programming and Java Server Pages are relatively understood and can be read!

Before you learn about Servlets and JSPs, let me remind you:

In essence, the servlet is a server-side server-side program that implements the Servlet interface. It can be written like any other Java application, it can manipulate the database, can manipulate local files, can connect to local EJBS ... The general process for writing a servlet program is:

1. Inheriting a HttpServlet class;

2. Covering its doget and Dopost methods;

3. Internal operation method Parameters HttpServletRequest and HttpServletResponse in the override method.

4. Read requests take advantage of HttpServletRequest. With HttpServletRequest you can manipulate the protocol header of the HTTP protocol, the method of operation that can be requested, the path that can be requested, the string that can be requested, and the information related to requesting the client. More important you can get both the cookie and the HttpSession object.

5. Using cookies you can manipulate the "sweetheart" object or write it to HttpServletResponse.

6. You can use HttpServletResponse to export information to customers. Use HttpServletResponse to write to various types of protocol headers, to increase cookies, to redirect other URLs, and to send a status code to the client for the HTTP protocol.

7. Use HttpSession to complete any functions you wish to implement within the session.

The servlet also provides some event and event listeners (simple observer mode only). There are also filters (filter) and wrappers (Servletrequestwrapper, Servletresponsewrapper)-Simple flow usage and adorner mode use.

Learn Sevlet, JSP must be deployed to the server, remember the usual file deployment steps and parameters of the settings and how to use in the program can be.

After fully understanding the servlet, learning JSP is relatively easy! The JSP is built entirely on the servlet and is designed to cater to programmers who like to embed scripts such as PHP in HTML documents. It's quite easy to learn!

Everything seems so calm, simple and studious! There is a complex mechanism behind the simple representation. To thoroughly study servlets and JSPs, you need to study the implementation of open source software such as Tomcat. It is nothing more than a server, after the customer uses the Web page through the HTTP protocol to send a request to the server, the server converts this HTTP request to the corresponding HttpServletRequest object, calling the servlet you wrote, You must have manipulated this httpservletrequest in your servlet, and operated httpservletresponse at the same time. The server sends this httpservletresponse to your browser using the HTTP protocol as required by the HTTP protocol! After the server-side JSP Web page is requested by the client, Tomcat compiles the JSP file using the template from the javax.servlet.jsp package, compiled with a servlet! The next operation is exactly the same as the servlet!

In the servlet and JSP based on the emergence of the so-called advanced technology: Jstl,struts ... Nothing more than the use of some tags and mvc patterns.

Go ahead! Victory is in front!!



7. Multithreading
A very mysterious, but very easy to get started, difficult to master the direction!

I recommend two books that I feel are very good. First of all, my first instinct to read the book, Sams 1998 published the Java Thread programming, write a bad, easy to read, I have time to see the notes at the moment! You know how to be good to see it yourself! The second oreilly three times published "Java Threads", the latest is 2004 version, domestic seems to have Chinese version, recommend you or read English version of it! The book talks about n directions related to multithreading, such as Io, Swing, collection, and so on.

Give us a little hint! There are not many multithreading-related classes in the Java class Library, mainly: thread, Threadgroup, and Threadlocal and inheritablethreadlocal four classes and a runnable interface; keyword synchronize, Volatile, and wait, notify, Notifyall methods for object Objects!

1 Thread is the core class of multithreading and provides a series of methods for creating and manipulating multithreading.

2 Threadgroup is a tool class that manages thread.

3 threadlocal and inheritablethreadlocal provide thread with a class of storage thread objects similar to the Safe box function!

4 runnable Needless to say!

5 Synchronize is the core of synchronous method and synchronization block! When multiple threads call this method, only one thread can use this method, and other methods block, thus guaranteeing the internal state integrity of the manipulated object. When a thread calls a method or block with a synchronize, it gets an object lock on the object, frees the object lock after the operation in the block, and other objects can continue to operate.

6 Wait, notify, Notifyall provide an effective wait/notification mechanism. Each object in the Java language has a lounge where any thread breaks in the object's lounge, frees the object lock, and, when the object is manipulated by another thread, wakes the thread in the lounge, checks the condition, and then performs the appropriate action when the condition is met.

Multithreading roughly on so many foundations! It's simple! This for a real programmer should be not enough, the real multi-threaded to have some grasp, please study java.util.concurrent package it! Master Doug Lea's work, originally a repository of open source conformance programming, was later incorporated into the Java class Library by Sun. The author's website also has another version of the class library! A good thing worth studying! Hibernation, OPENJMS and other open source software have used this package!



8. Design mode
When it comes to design patterns many people will recommend Gof, the book on Amzon is a five-star recommended book. But to learn Java not long, especially Java beginners, I do not recommend this book. The main examples of this book are basically C + +, and many details are not sufficiently clear.

I recommend the first one is Dr. Shanhong's "Java and Mode", it is the first Chinese to write about the design patterns of books, writing more interesting, the integration of a lot of Chinese culture and ideas, examples, class diagram are more, and relatively simple! Very good introductory book-again big Oh!

Second I recommend Wiley Publishing "Pattern in Java" Set of three, I read the first, as if the second book is not good, the third is not bad!

The third is the Chinese translation version of the multi-threading mode (very rare Chinese translation version) China Railway Publishing House 2003 published the "Java Multithreaded design mode", the multi-threaded mode is very simple, with a large number of legends, each chapter has exercises, finally have the answer! I started by studying the multithreading pattern!

Fourth, this year's head first series, "head First Design Pattern", adhering to the advantages of Head first series books, a large number of class diagrams, rich examples, interesting annotations, worth buying!

Second, in the direction of the Java EE you can study reading Addison Wesley 2002 published "Patterns of Enterprise Application Architecture", the work of many big names, talk about Enterprise news integration! Sun-provided "PATTERNS SL500" is also very good! Late recommended that the Amzon 4 stars and a half of the "Holub on Patterns", the master's works, provided, it is worth studying the example, but to the above four is not very familiar with the reader, it is best not to read it! May make you more tired!

I study design patterns after a very tortuous route, and then read about 20, Dr. Shanhong's "Java and Mode" I saw 4 times, but also ruled out the first time I did not understand the basic look! Remember the teacher told us the GOF, as an elective, I and their computer department master, PhD, to the last class 40-50 people, not more than 3 person understand, I did not understand any point (base poor bar-mainly I do not understand the C + + language), with my not lose the character, I think I understand the Java language can also, I borrowed the "Java and Mode", the results are basically not read. It is fortunate to read the study three o'clock, heard Ober La Jonan teacher about the Java OOP language lectures, I understand the combination of book mode and other three design patterns, to other models have a strong interest and to conquer it's desire! After work I bought the first book is "Java and Mode", the first time spent 2 months to study this 1000 more pages of the big, and then the third time around 15 days can be done, notes a large book! From then on.

Choose the right book and bury the research. I'm sure we'll get started soon!



Learn the Java language 8 simple parts, this is just the beginning of our study of the Java language! These all understand that at best a Java programmer, the back of the road is very long! We can continue to study the source code of the database implementation, the source code of the servlet server, RMI, EJB, JNDI, aspect-oriented programming, refactoring, ant tools, Eclipse Tools, spring Tools, JBoss, JOnAS, Apache Geronimo and other Java server! Study these you may become an excellent EE architecture! You can continue to study profilers, compilers, JNODE (Java-written operating systems) ...



Thank you all have this patience, listen to my Luo wordy big half a day! Thank you for reading, thanks to the group of friends! This article is mainly the voice of friends in the group-do not know how to choose the book, do not know where to look! The most days of Kung fu to complete the article, the words inevitably have errors, but also due to the limited ability to have errors! Please read and criticize!

The above is my study of the Java language Order, the above books are I have read, there is no publicity for any publishing house ingredients! Some methods may not be suitable for you, if you can harvest a little, two points or more, please do not stingy recommend to your friends-learn together!

Thank you for reading, thanks to the designers of the Internet, thanks to the Java designers, thanks to www.open-open.com and Www.sourceforge.net website!

Java recommended readings and source code reading

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.