Basic Java Knowledge

Source: Internet
Author: User

JavaSummary of basic knowledge points1.What is a computer program?

Parsing: A collection of ordered instructions written to solve a problem.

2.JavaWhat are the relevant technologies?

Parsing:javase ( desktop application ) Java EE ( website ) javame ( mobile app ), Has now been replaced by Android

C (Client)/S (Server) program : can parse executed programs without using a browser

B(broswer)/S (Server) Program: You must use a browser to resolve the executed program

3.DevelopmentJavaWhat are the steps of the program?

Parsing: Writing, compiling, and running

detailed steps for writing the first Java program

Configure environment Variables

001. Right click on my computer → properties → advanced system settings → environment variables → system variables, in system variables

To find the name of a variable with a path , click the " Edit" button and press the "Home" key to

Cursor is positioned to the first position

002. open "My Computer" → Open drive C → Find "programFiles folder" →Java→ jdk1.7.0_17

→bin, copy path

003. paste the copied path to the cursor flashing position, followed by a semicolon (;)

004. Go all the way until all the windows disappear.

005. open "Start" → "run" → input cmd→ input javac Enter , if there is a series of Chinese, prove

The environment variable was configured successfully.

Write the code .

001. in the root directory of the D drive, create a file with a suffix called java named Hello .

002. Writing Code

compilation .

Use the javac command to compile a file with the suffix . Java as a file with a . class suffix ( Byte-code file )

run .

A file with a . Class suffix is run with the Java command , and the suffix name does not need to be run .

4.Javawhat is the basic framework of the program?

Analytical:

public class R01hello {

public static void Main (string[] args) {

System.out.println ("My first Java application, please take more care!") ");

}

}

. Java Structure Inner layer framework four elements:publicstatic void Main (string[] args) {

}

5.MyEclipseUse of tools

What is the difference between myeclipse and Eclipse ?

Parsing : MyEclipse features are more powerful .

6.Escape Character

\ n: line break

No Line break symbols:

Run results

Add newline symbol:

Add newline symbol:

Note: The newline character can be placed before the character to be wrapped, or in front of the next line of characters (usually after the newline character)

\ t: a series of spaces

Normal results:

\ t: Post result

7.JavaWhat are the annotation types?

Parsing: The role of annotations : facilitates later maintenance of the project

to facilitate the reading of members within the team .

The comment will not be compiled by the Java compiler, and thejava compiler will skip the comment.

Why write comments: In order to follow us to read the code convenient, so we have to develop the habit of writing notes,

Because the comments accounted for three points during the final exam, the comments accounted for a large proportion during the interview.

First Type: Single line comment //

The second type: Multiline comment /**/

If the cursor renders a relatively wide style, press the Insert key on the keyboard to restore the cursor.

8.WritingJavaNote for the program:

01.java code is strictly case sensitive.

the curly braces are to appear in pairs .

A. write the left curly brace at the end of a line of code ({)

The code should be written into the inner frame.

All of the code we write is in the English half-width state, otherwise errors may occur .

Each statement in 06.java ends with a semicolon

the class name cannot begin with a number

9, inMyEclipsein creating aJavaProject

Change workspace: Click File→Switch WorkSpace→other→ Browser→ Select the D - plate

A folder, click OK, the environment will automatically close. The first phenomenon: to quote a red fork,

The second phenomenon: ask if we want to go to Software Center (software), tick the checkbox, and click Cancel.

Create a Java Project: Click File→New→java   Project

Right-click on the src folder,New→Class

write the code, after writing, Run the program through run (the green triangle icon)

The results of the operation appear on the console console.

10.How to adjustMyEclipsethe font size in

Find Windows→Preferences→ input Fonts in the menu

Remaining content See picture

11,JavaProject Organizational Structure

The package Explorer

Classes to manage multiple different functions

After the package Explorer is closed, it can be opened according to the diagram:

The Navigator (Navigator)

Role: Similar to Windows Explorer, skills to see java files, but also to see the compiled class file

The navigator can be opened according to the diagram:

12,MyEclipseCommon Operations

How to display line numbers

Official resolution: Right-click on the left-hand side of the code editing area, and in the popup menu, tick () Right-click on the white area of the red box to select Show Line Numbers

Delete an item .

Analysis ; directly Select the item you want to delete, right-click and find Delete , but notice here, don't

Or the real files on the hard drive will be removed. Then OK

How do I import a project??

Parse:File→Import→general, find the longest one, (asshown)

How to rename a project

Resolution: Select the name of the item you want to modify, press F2on your keyboard, and then make sure you have modified it.

13.When a statement misses a semicolon, the error is described as follows

1.Syntax error, insert ";" To complete Statement ( syntax error: Insert semicolon Completion statement Description )

2.system cannot be resolved, system cannot be parsed, letter-case issues

3.cannot be resolved, cannot be parsed, missing double quotes when error description

4.Syntax error, insert "}" to complete classbody, syntax error, insert} Perfect class body.

14.javaprogram compilation and execution process

The file with the suffix. java is compiled by the Java compiler into a file with the suffix . class .

The file with the suffix . Class is compiled for the second time by the JVM(Java virtual machine) and compiled into CPU can

Code to identify

Basic Java Knowledge

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.