JAVA basics: What are precautions for beginners of Java?

Source: Internet
Author: User

Java always has a thousand benefits for you to choose from, but you can find the answer by simply turning over the book or visiting the internet. In this article, I will write some of my experiences and processes in learning Java for beginners to make a reference.

In the course of learning Java, I will focus on the following aspects:

1. Always remind yourself that Java is an OOP language tool, not just code. Only in this way can we grasp and use Java as a whole.

2. In the course of learning, it is best to understand the underlying mechanism of Java, rather than just staying on the surface, rather than running the example on the copybook to get the result. You must be patient in thinking about, debugging, and modifying a simple example.

3. In the course of learning, you must start and write code, instead of holding a book and reading it. Many things and experiences must be done by yourself to truly belong to yourself. It is best to participate in some practical projects.

4. After learning a certain stage, you begin to want to do something you have learned. At this time, you should begin to learn more and more complex knowledge, such as the construction of the J2EE platform and the Development of EJB. For this part, I suggest you find a thin book to understand it first, and have a general understanding in your mind to get a preliminary understanding of more technical terms. I think it is good to see J2EE technical practices at this stage. It can help you understand the various technologies and frameworks contained in J2EE and provide many practical examples to deepen your understanding of J2EE.

Interest and determination in learning Java play a key role. With the above basics, I began to learn Java step by step.

Build a Java environment


To run a Java program, you must install JDK. JDK is the core of Java, including the Java compiler, JVM, a large number of Java tools, and Basic Java APIs.

JDK 1.4 and 1.31 can be downloaded from the http://Java.sun.com. In my learning environment, Version 1.31 is used first.

Decompress and install. Then, set the environment.

1. perform the following settings for Windows:

     
      set PATH=YOUR_INSTALL_ DIRin; C:Windows;C:WindowsCommandset classpath=. ;YOUR_INSTALL_DIRlibools.jar
     


2. Edit the/etc/profile file for Linux:

     
      JAVA_HOME=your_install_dir/JDK/j2sdkCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/td.jar:$JAVA_HOME/jr -e/lib/rt.jar:.PATH=$PATH:$JAVA_HOME/binexport PATH PS1 USER LOGNAME MAIL HOSTNAME HISTSIZE HISTFILESIZE INPUTRC JAVA_HOME CLASSPATH RESIN_HOME
     


Finally, enter Java on the terminal to check whether the command can be found. If the command can be found, the installation is successful.
The following describes several important JDK commands:

◆ Java execution tool is a command to start JVM (Virtual Machine) and execute the class (byte code) file;

◆ Javac compiler, which is generated by the. java file. class file;

◆ Jar Java compression and packaging tools;

◆ Javadoc document builder.

The last step is JDK Documentation. This is JDK's online help document and is the most useful and important learning reference document.

Start writing your own code


Now that the environment is ready, you should write a simple code for testing. Or from the classic "hello word.

1. First Use the editor to write a code (I use the Linux vi ):

     
      [stone@coremsg work]$ vi Hello.Java public class Hello{ public static void main(String []argc){ System.out.println("Hello Word!"); } }
     

2. Compile:

      
       [stone@coremsg work]$ Javac Hello.Java
      


3. Execute:

      
       [stone@coremsg work]$ Java Hello Hello Word!
      


Successful! This is my first Java program. Since then, I know that I have started to enter the Java World, and then I will rely on my own efforts. In this process, I think there are several points worth attention.

Learning a new language is inseparable from reference books. My advice is to find a short getting started book to learn the simplest and most basic things, including learning Java syntax. At the same time, debugging should be performed on the simplest program. Think about the result if you change it? Why must I write that? Think more about these problems and then perform operations, which will give you more gains. It is useful to think over and over again. In addition, you should also look at the online help of JDK at this stage to learn as much as possible about the Java basic class library API provided by JDK.

After you have basic knowledge and can write some simple programs, you can start reading Thinking in Java. It fully introduces Java syntax, object-oriented features, core class libraries, and so on. Through this level of learning, we can deepen our understanding of Java and the use of underlying principles, while at the same time, we can fully understand the entire Java System. At this stage, we should focus on learning the features of Java's object-oriented programming language, for example, inheritance, constructor, abstract class, interface, method polymorphism, overload, overwrite, Java exception handling mechanism, etc. You must have a very clear understanding of the above concepts. The purpose of doing so is to apply these technologies to practice for rational programming (for example, you will consider whether a class is designed using abstraction or interfaces ). This requires that you must apply and learn in a large number of practices. This is also the advice that many of my friends gave me.

Learn more


If you want to use Java to complete a variety of more powerful tasks, you need to learn more than the language.

1. Java Web Programming

For Java Web programming, you must be familiar with and master the HTTP protocol. For details, refer to chapter 3 of the TCP/IP explanation by Steven S. Java Servlet technology provides the ability to generate dynamic Web page content, which is one of the most basic functions in your Java project, so you must learn. Through this phase of learning, you should master the Web programming of Servlet/JSP.

2. J2EE Learning

There are too many technologies in J2EE. If you want to sit next to a table and hold a lot of books to learn, it will not be very effective. I suggest that you follow the steps below when you start learning at this stage. The general idea is "overall control, break through each other ".

◆ Understand the meanings of technical terms in J2EE.

I think there are a lot of technologies involved in the J2EE standard. It would be unrealistic and ineffective to learn them one by one at the beginning. My suggestion is to have a rough understanding of the technologies, such as EJB, JavaIDL, and JTA. Maybe you don't know how to write an EJB, but you need to know what EJB is and what it can do. With this concept, it will be much faster to learn it purposefully. I want to repeat it again-it must be done in practice.

◆ Understand the design pattern in J2EE, which helps you grasp J2EE as a whole.

The MVC development mode has been proved to be one of the effective solutions. It can separate data access and data performance. You can develop a scalable and scalable controller to maintain the entire process. At this level of learning, when you are facing a project, you should first grasp its overall architecture design and decide which technologies adopt the J2EE standard.

◆ Understand some typical cases of the J2EE platform and deepen the concept and understanding of this technology.

I usually pay more attention to this aspect. I am familiar with some typical cases and analyze why it should be used at that time? What is the purpose of doing so? Then contact your project for reference.

◆ Learn various technologies under J2EE.

After several stages of learning, you can build a J2EE platform and start learning each technology. You can participate in company-related projects or build a platform on your own. At this time, you should find related books to learn them step by step. There is no shortcut. If you are not satisfied with this, you should also learn more about UML and design patterns.

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.