Java is a universal programming language, can actually do a lot of things, how to learn Java to see how to use, but there are some general steps:
Familiar with a text editor, such as: Vim, Emacs, notepad++, TextMate and so on. Know which are open source, which are closed source, and which are charged. Develop the habit of not using pirated software.
Installing the JDK (it is recommended that you install OPENJDK with the package Manager that comes with your Linux distribution, and you may need to read the release-specific documentation in the process)
Write a Java HelloWorld program, use the command-line tool Javac compile, and then run the program with Java commands. The process is familiar with the source code, bytecode, virtual machine These things, and the Java Packages (package) affect the path where the. class file resides. If both command-line tools are proficient, you can start choosing a favorite integrated development environment, such as Eclipse. Of course, develop the habit of not using pirated software. Be familiar with how to establish "engineering" and the use of shortcut keys.
Learn Java's process-oriented programming, including basic data structures, expressions, statements, control flows, function calls.
Learn Java's object-oriented programming, including classes, reference types and value type differences, members, methods, access control, inheritance, polymorphism, interfaces, interface implementations. By the way, learn the basic idea of object-oriented, that is, object, message, encapsulation, inheritance, polymorphism, etc., these common content is not Java-specific. This should already involve Java garbage collection. Be aware of memory leaks that occur even with garbage collection (such as designing array containers yourself, elements are references, elements are logically removed, but not Qingcheng null). Note Garbage collection can only reclaim objects in memory, and other resources cannot be shut down by garbage collection other than memory. For example, files, pipelines, sockets, database connections, and so on, garbage collection will not help you shut down.
Learn about Java exception handling, but it is more important to learn when to use special return values instead of exceptions, when to throw exceptions without handling exceptions, to know what Pokemon catch and its hazards, and to understand why Java's checked exception is a bad feature. If you want, learn about Java1.7 's Try-with-resource statement and autocloseable interface at the same time.
Familiarity with common Java data structures, such as basic array types, and generic containers (java.util.*), In particular, java.util.List interfaces and Java.util.ArrayList implementations, as well as JAVA.UTIL.MAP interfaces and JAVA.UTIL.HASHMAP implementations. (You don't have to touch the previous java1.5 without a generic parameter) also notice the difference between the basic type int, double, and the boxed type integer and double, and how they are automatically converted.
Familiar with various tools in Java standard library, including date time, string formatting, IO, etc. * * If you know the file you want to close () in the finally clause, or use Java1.7 's Try-with-resource, don't be paranoid that the garbage collector will turn off the file for you.
Learn about the naming habits of Java, and the general JavaBeans, and know why Gettertter is better than directly manipulating member variables. In this way, the Java variables, methods named. Also see if your IDE can automatically generate getter and setter for you.
Use a third-party library (such as the Apache Commons Lang Common Tool Library) to have your program rely on its binary jar package (instead of copying the source code directly), compiling and running with the command line (note classpath, etc.) And be familiar with how to add third-party dependencies with your integrated development environment. Feel the hassle of manually managing dependencies.
Learn about Maven's use, try to get Maven to help you with dependencies, and then try to get Maven to help you create an Eclipse project. Try Maven package release again.
Learn about software testing, how junit is used, and how junit is used in the IDE. Have time to look at coverage tools.
Read the "design pattern" written by Gang of four (this book is in C + + and Smalltalk languages, but it is still suitable for Java).
The next step is to look at the specific aspects of the application, to see the needs. For example (no order below)
Debugging and Accessibility tools
Learn about the debugging tools provided by your integrated development environment and try adding breakpoints.
Try Jconsole or VISUALVM to monitor the status of another JVM.
Use the profiling tool to find the slow place in the program. Eclipse has profiling tools. VISUALVM also has such a function. (If you don't mind using closed source software, try Jprofiler and Yourkit)
Some JVMs allow code to be updated at run time. Eclipse can be integrated with some JVMs. This allows you to modify the code frequently without restarting the JVM frequently. Useful for some "heavy" projects. (If you do not mind the use of closed-source software, also try Jrebel)
Multithreading
Learn about multithreaded programming for Java and the use of lock, condition (including traditional Java synchronized statements and new java.util.concurrent.*) to learn how to stop a thread And why you should frequently confirm isinterrupted () instead of Thread.stop (). Find out how multicore processors, caches, memory relationships, and why multithreaded programming is so difficult.
If you are comfortable, learn about the usage of runnable and the basic multithreaded tools such as Executer.
You should have noticed that many of the containers inside java.util are not thread-safe, but java.util.Collections can help you create some secure versions. Also pay attention to java.util.concurrent inside there are concurrentmap and other containers for use.
If you are free, look at the memory model and lock-free synchronization (see Java Memorymodel and Java.util.concurrent.atomic).
If you are free, learn more about other models besides "Shared memory multithreaded Programming" (Multi-process multi-processing, messaging message passing, etc.).
Reflection, Meta programming
Learn about the reflection mechanism of Java, and the use of annotation.
If you're comfortable, try Java.lang.reflect.Proxy's usage.
If still comfortable, play a game of Cglib (a third-party library).
Network programming
Learn about the IP,TCP protocol (computer majors should learn, review), learn socket programming (note that the garbage collector will not help you switch off the socket).
If you are not very concerned about HTTP, look at Java.nio, learn single-threaded polling IO multiplexing (Selector).
If you don't understand the intent of NIO, get to know the c10k problem. Http://www.kegel.com/c10k.html
If the body does not have a strange words, probably understand the operating system (including the C language) provided by the Select, poll, Epoll, Kqueue and other interfaces.
If the body is still not strange, try writing a file server with Java.nio.
If there is energy, then the Internet to pick up a steak there is no other communication library, such as Netty.
If you care about the Web and HTTP, learn about the HTTP protocol and client programming with Java for HTTP.
If you're comfortable, learn HTML and write static HTML pages (no Java required)
If you're comfortable, write a Web parser (crawl Web page) based on DOM, XPath, or CSS selector in Java.
If you're comfortable, learn Java's servlet interface (don't learn JSP first) for Web server-side programming. Learn how to use the standard servlet container, including the use of Web. XML and the concepts of listener, filter, etc. and the specific use of a servlet container, such as jetty or Tomcat.
If it's still comfortable, try learning a template language (like Haml, Velocity, Freemarker, "Are there other better frameworks?"). I don't know, "String.Format, if you really want to learn JSP, JSP is OK, but not recommended."
If you still feel comfortable, learn the web framework in the spring framework, or struts, to see your tastes.
If you're comfortable, look at Spring Bean container and all sorts of messy tools inside.
If you're comfortable, or have a need, find out what a restful Web Service is, review http, and find the right Java tool.
You might think that Jackson is a useful thing to parse JSON with.
Database
Learn about relational databases (computer majors should learn, review), including SQL. Choose a database management system to familiarize yourself with (such as mariadb, or (if you don't hate Oracle) with MySQL acquired by Oracle. Learn from Java alone). Then look at their official documentation to teach you how to connect to this database in Java. This will involve the JDBC interface. Also be sure to know the SQL Injection security vulnerability, and how to use PreparedStatement to prevent injection!! Suggested See http://bobby-tables.com/
There may be a "transactional" problem in between, letting you unknowingly start to understand the Java Transaction API (JTA).
If you're comfortable, learn about object-relational transformations (such as hibernate). You can also learn about non-relational databases and how to access them in Java.
Log records
Learn about the use of slf4j and Logback.
If you have the energy, you probably know how many Java log frameworks are in the world, and how slf4j bridges these frameworks.
Building (build) system
Learn about ant usage.
If you're comfortable, learn to use Ivy to download packages from MAVEN's repositories to resolve dependencies.
Version control
Learn the basic usage of a distributed versioning controller (such as Git, Mercurial, BZR, DARCS, etc.) and how to use it to manage Java engineering. Hopefully you've started using Maven and know why it's not good to put IDE-generated project files (such as Eclipse. Project,.classpath and. Metadata) into the version controller. Then learn how to use version control in the IDE (Eclipse comes with a git plugin).
If you feel comfortable, build a linux+ssh+git server for your lab, and install a Gitlab (a Web interface).
Learn the difference between "centralized version controller" and "distributed version Controller" and persuade colleagues to stop using old "centralized versioning controllers" such as SVN, CVS, or SourceSafe.
Open a GitHub account. If you don't like git, use bitbucket and so on.
Continuous integration
Build your own (or for your lab) a continuous integration (continuous integration) server, such as Jenkins, to compile your program regularly. It is recommended to use a distributed version controller such as Git.
If you do open source software, try GitHub and Travis.
Fragmented tools
Amoy a Amoy java.nio.files inside have what to use of East, then Amoy a Amoy apachecommons Lang and commons io have what useful tool. Commons logging do not use again, with SLF4J and Logback.
Xml
Learn XML, DOM, XPath. XML is something that can be used everywhere. You can also use it to write your own configuration file.
If you feel uncomfortable, learn json and YAML.
If still uncomfortable, learn to study text file parsing.
Syntax analysis and compilers
Learn to learn ANTLR or other parser generator usage
If you feel comfortable, write a calculator yourself.
If you still feel comfortable, write yourself a domain-specific Language (DSL).
Efficient containers
Learn Fastutil or trove, if you need to do a lot of numerical calculations.
Distributed computing
Learn the idea of MapReduce and its realization.
If you're comfortable, learn the Scala language and Apache Spark, which is much faster than MapReduce.
Inter-process communication
Look at Activemq, Mina and RMI.
Other languages (JVM)
Learn another language or implementation that runs on the JVM (such as groovy, Scala, Clojure, JRuby, Jython, JavaScript ...). )
If you're comfortable, learn the Java Scripting API (note that it's not JavaScript.) Give a link: http://docs.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/), and then try embedding the script in your own Java program.
Other languages (non-JVM)
Learn another common scripting language (such as Python, Ruby, actually Perl is OK, but not recommended) and know when Java is not the best choice.
Java languages and Java virtual machines
Read through (Yimushihang, not read) Java Language specification, and Java Virtualmachine specification.
--Understand the concepts of the following interpreter (interpreter), compiler (compiler), instant compiler (Just-in-time compiler), and Optimizer (Optimiser).
--If you are not afraid of the compiler's topic, learn the concepts and differences between the method JIT and the tracing JIT.
Memory management
Learn the basic methods of garbage collection, including Mark-sweep, Mark-compact, Semi-space, generational, mark-region, and so on, their respective performance, And why the plain referencecounting is incomplete. Know why finalizer performance is poor, and the standard does not require finalizer to be executed before the program exits.
If you're comfortable, find out how to set the heap size limit for Java virtual machines (such as the-XMX option for a hotspot virtual machine).
Learn about the WeakReference and SoftReference and Phantomreference in Java, and when they are useful, and why they are difficult to implement.
If you have the energy, find out what the memory management algorithms of the hotspot virtual machine are.
Dynamic loading
Learn the dynamic loading of Java (class loading)
If you're comfortable, learn about OSGi and its implementations (such as Felix or Equinox).
If you're still comfortable, learn to write programs based on the Eclipse platform. Not the Eclipse integrated development environment, just use their graphics framework to write their own applications.
If you still feel comfortable, write a plugin for the Eclipse integrated development environment.
Local/Foreign Language interface
Learn about Java Native Interface (JNI) and try to write a program that mixes Java and C language programming.
If you feel uncomfortable or feel like dying, learn Java Native Access (JNA), try to load the C library directly from Java without any glue code, and call the C function directly.
If even JNA also lazy to learn, learn swig, automatically generate bindings.
If you feel comfortable, learn Java Virtual machine Tooling Interface (JVMTI) and use a C program to monitor the state of the JVM.
Cryptographic Science
Learn cryptography, including coding, cryptanalysis, attacks, symmetric keys, public key systems, digital signatures, hashing algorithms, and so on, to see if Java is implemented.
If you feel a little uncomfortable (you should not feel comfortable, unless you are learning cryptography, or you will always feel that your program has security loopholes), write a "character calculator" to relax, ask each time to enter the same name, get the character value is fixed, But it is also impossible to use other people's character value to guess their personality values.
Mobile Terminal
Learn to learn Android development.
If you have the energy, look at what's going on with the Dalvik virtual machine.
Suggest buying an iphone or ipad, or you may never want to use an Android phone or tablet.
History
If you feel bored, dig into the history of fire and Java-related technologies, such as:
Applet, think about it than the shortcomings of Html5+css3+javascript.
AWT, Swing, think about why very few people write GUI programs in Java. Do you think swing's program looks comfortable? Do Chinese and disabled people like to use swing programs?
JNDI, think of it in comparison to the shortcomings of spring Bean container.
JSP, think of it compared to the shortcomings of the MVC structure.
Wsdl/soap, compare them to the XML-RPC, RESTful Web service.
XSLT, and why it is Turing-complete. But is it really better than Java itself?
log4j, java.util.logging, Apache Commons logging, what are their own problems, and log4j the author of why he also developed slf4j and Logback?
Why was Java originally designed?
Type Erasure What's going on? Why can't arraylist<int>, but arraylist<integer> can? Dig a dig in history.
In fact, Java is not a fully object-oriented language. Java is more practical, and many control flows (if statements, while loops, for loops, etc.) come from a process-oriented language; the base data type (int, char, double, and so on) is not an object. But other languages, such as Smalltalk, are more biased towards purely object-oriented design, including basic data types are objects, and if/while/for are also implemented using objects and methods. Like what:
The base data type is also an object that can accept messages (that is, methods), such as:
(A + b) sqrt
In this, a+b is actually sending a "+" message to a, and the parameter is B. SQRT is also a message sent to a number.
if The branch does this:
| (x < y) Iftrue: [
Max: = y.
I: = j
] Iffalse: [
Max: = x.
I: = k
]
Iftrue:iffalse: Is a Boolean object of a method, take two parameters, each is a "block", respectively, in the case of true and false execution.
There is a while loop that does this:
| [I < 100]whiletrue: [
Sum: = Sum + i.
I: = i + 1
]
Whiletrue is a "block" method, each time the block evaluation, if it is true, repeated execution of the first parameter (also "block").
Therefore, Java is not "object-oriented" relative to other object-oriented languages. So you need to add some understanding of the object-oriented language.
The path to Java learning