The first day of learning Java in 2018.3.6

Source: Internet
Author: User
Tags stub java se

Learn Java, then have to understand Java,java is divided into three parts, Java se,java ee and Java ME, of which we first want to learn Java Se.java is a language, we usually dialogue between people, in Chinese, in English, in Japanese, These are the language that people and people communicate need to use, then if we want to make a software, then it must be a programmer to use a language with the computer to communicate, then Java is such a language, you have to use this language and computer communication, so that it understand what it is to do.

Java This computer language and we use the natural language is not the same, we use the Chinese English and Japanese are can say, can read, can write, but for Java this programming language, it is not verbal communication, we can only write down to the computer, let it go to execute, since to write down the words, Then we need a book, a place to write, here we call the editor (English: IDE), we learn the HTML language (programmer and Browser language) To use an editor such as Hbuilder or sublime or Dreamweaver or Webstorm or a notepad such as a Windows computer, we learn that Java uses editing software such as Eclipse or myeclipes. Myeclipes is charged, eclipse is free, so the latter we use often a little more, the two functions are roughly the same.

Referring to eclipse, then we have to mention the installation of Eclipes, before installing eclipes, we have to install JDK,JDK (also known as the Java SDK), the JDK is the Java language Software Development Kit, mainly for mobile devices, Java applications on embedded devices. The JDK is the core of the entire Java development, which contains the Java Runtime Environment (Jvm+java System class Library) and Java tools. If you do not understand the meaning of the JDK, you can not understand, just remember that you must install the JDK before installing the Eclipes, specific installation methods, I have also written before, there are many tutorials on the internet, do not repeat here, but there is a point to emphasize, lest everyone and the future I do wrong.

When copying path and Classpath, the former remember not to delete the previous value, but to add it, the latter remember is the equal sign, point "." Don't omit it.

After the JDK and eclipes installation is complete, we open eclipes, complete a small project, and output a "hello,world!" in the console.

First of all, to create a new project, the steps are as follows,

1. Right-click on the project area on the left, new >>project>>java project, tap Next, enter the project name of the project you want to create in the new page, we will name "HelloWorld" here, then click Finish,

After clicking Finish, the new pop-up window lets you choose Yes or no, just ignore him and click No.

After creating a new project, we will also create a new class, which is the next file we want to write the code in, the following steps:

In the project area on the left, point to the newly built project HelloWorld, which has a SRC folder, right-click on the SRC folder, select New, this time select class:

Next, you need to give the class a name in the new pop-up window, the requirement is lowercase (we write the program, all English, support for the English language is the highest, do not recommend the use of Chinese, etc.), we have a new class name called Hello, click Finish

Next, in the edit area on the right, write down the following code


public class Hello {
public static void Main (String args[]) {
System.out.print ("hello,world!");
}
}

Precautions:

1. Punctuation must be in the English state;

2. All brackets are in pairs, () {}[];

3.java strictly case-sensitive;

4. Each line must be ";" End

5. Reset Window windows>>reset;

6. Note the location of {}, recommended as written above, develop good code habits, the system automatically adjust the format with ctrl+shift+f, or right-click source>>format;

7. Remember to save;

The difference between 8.print and println, which is equivalent to adding a newline character at the end of the line.

Comment Method:

1. Single-line annotation with "//";

2. Multi-line annotation with "

/* Comment Text

Write here * * ";

3. Documentation Comments

/**

*/

Escape character

\ t equals Tab key

\ n equals carriage return newline, line break

Small exercise:

The code is as follows

Package pro_0306_01;

public class Mymsg {

public static void Main (string[] args) {
TODO auto-generated Method Stub
System.out.print ("name: Zhang San \ n Gender: Male \ n Age: 20\n Height: 1.77");
}

}

The code is as follows:

Package pro_0306_01;

public class Goodslist {

public static void Main (string[] args) {
TODO auto-generated Method Stub
System.out.print ("\ t shopping list \ nthe product name \ t Purchase quantity \ t commodity unit price \ r amount \ n mi phone \t1\t1900\t1900\n Thermos cup \t2\t30\t60\n");
}

}

The first day of learning Java in 2018.3.6

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.