Getting Started with Java (a): Hello world!

Source: Internet
Author: User

Objective

Starting today, to write a series of articles on Java Web Development, after all, their main focus is the Java direction, Python is only the interest of amateur learning, in the second skill has not been developed before the maturity of the first skills to consolidate and improve is necessary. From the formal entry (first job) to today has been 10 months, ashamed, outside the working hours, little learning and promotion, coupled with the company's internal use of two developed closed framework (no use of the mainstream open source framework), the previously learned SSM framework basically forget, There are also some related knowledge of the familiarity has been declining, which makes people very frightened Ah! The way to rescue is to regain the foundation, do some cases, the combination of theory and code to deepen the impression, to maintain competitiveness!

Queen of Hearts said a word, very sensible, " at your current speed you can only stay in situ." If you want to reach another place, you have to run twice as fast as you are! "in the 2018-year-old speech of the Luo's mind, there is a saying," you must keep on running to stay in place. " "The truth of the two sentences is similar, if you can give the status of dissatisfaction with the slightest touch, then, please try to run it!"

The goal of the first phase is to complete the introductory series of Java articles, including basic syntax, object-oriented, common tool classes, collections, IO, threads, exceptions, sockets, and so on. The second phase will write database-related knowledge. The third stage is the Web knowledge, HTML, CSS, JQuery, JavaScript, as for Angularjs, if the time is sufficient, will write something related. Phase IV is a servlet-related knowledge, which is the focus of web development. The fifth stage is the use of the framework, will integrate the above mentioned things, do a case as a summary.

First, understand Java

Java is a recompile language, which itself contains a lot of class libraries, features, plus its derived from the related products, is a very large language system, with countless branches, the core is the JDK and JRE.

The JDK, the full name of the Java Development Kit, is the Java SDK that provides a Java development environment that provides tools such as compiler Javac Compile the. java file into a. class file) and run the environment (the JVM and runtime helper packages are provided, the. class file is parsed and run), and in the JDK's installation directory there is a JRE folder, which is the Java Runtime environment.

JRE, the English name is Java runtime enviroment, is the Java Runtime Environment, in the JRE installation directory, there are two folders, one is the Bin folder, under the Bin folder has a server folder, There are jvm.dll files in it, the entire Bin folder is the JVM, and the second is the Lib folder, which is the class library required to parse the. class file.

The JVM, the full name of the Java Virtual Machine, is the core of the JRE, and will be followed by a separate learning JVM.

Second, build the development environment

1, install the JDK.

Select the appropriate version of the Oracle website download on the line, address http://www.oracle.com/technetwork/java/javase/downloads/index.html,Java9 are out, do not know what new features, choose 8 Stable version on the line. After downloading, follow the instructions step by step installation, or self-surfing to solve.

To configure environment variables:

New Classpath variable.; %java_home%\lib;%java_home%\lib\tools.jar

New Java_home variable D:\java\jdk1.8.121 (for JDK installation path)

Change the path variable;%java_home%\bin;%java_home%\jre\bin (added on original basis)

Verify that the installation was successful: Enter cmd-and input java-version to see the JDK version information for installation success

2. Install Eclipse.

Download the installation package at Eclipse's website, address https://www.eclipse.org/downloads/download.php?file=/oomph/epp/oxygen/R2/ Eclipse-inst-win64.exe, choose the appropriate version, follow the prompts to complete the installation, or self-surfing the internet to solve.

Third, write your first Java program

1. Create a new project. Open Eclipse, Find File in the menu bar, click on the left mouse button, select New, select Java Project, in the box that pops up, in the Project Name column, enter the Javalearning, click the Finish button below. Note that when you fill in the name of the project, English must be lowercase.

2, the directory structure of the project. In the new Javalearning project, you will see that the SRC Resource folder and the JRE System Library,src folder are resources for packages, classes, and so on, and the JRE system library is the class library required for the Java Runtime environment.

3. Create a new class. First create a new class, right click on SRC, select New, in the newly emerged selection box, select Package, in the pop-up box, see the Name column, fill in the package name JAVALEARNINGDAY01, packet name must be lowercase. Then right click on the newly built package, select New, in the New selection box, select Class, in the pop-up box, see the Name column, enter the class name HelloWorld, click Finish below. Note that the first letter of the class name is capitalized, and if there are multiple words, it follows the principle of all caps in the first letter.

4, write the Main method.

 Package javalearningday01;  Public class HelloWorld {    publicstaticvoid  main (string[] args) {        System.out.println ("Hello world!") );    }}

5. Try to remove the access modifier public from the main method, right-click and see that there is no Java application option behind run as. Try to change the method name main to Main2 or another method name, and there is no option to run as Java application. Try to remove static, click to run, and do not have the option of Run as Java application. These are actually Java specifications, for the main method of the specification, it must be written, otherwise the compiler can not find the program entry, will not be able to run.

The article starts with my personal public number: Yue Lok book . I like to share the songs I've heard, the movies I've seen, the books I've read, the code I've been reading, the deep-night meditation. Look forward to your attention!

Public number backstage Enter the keywords "java learning ebook ", you can get 12 Java learning related e-book resources, if the economic capacity allows, but also to support the book author of the original paper books, creation is not easy.

Getting Started with Java (a): Hello world!

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.