Learn the first article of Java

Source: Internet
Author: User

Chapter I Java Fundamentals

1.Learning methods:

01. Find a good Book

The initial phase is not appropriate, can be placed in the second stage, when you see the knowledge point, to verify

02. View Help documentation and search engine usage

With blog posts on the Web

03. Don't make a quick buck

Don't hold on to the idea of a quick, otherwise inevitable detours
Learning to program is not a matter of overnight
Pay a high cost to have a well-paid income

04. Don't be impetuous

Don't learn everything, only learn useful

The degree of impetuous and the level of technology inversely proportional
Go your own way, let others go impetuous!

Ask yourself every day , I am not beginning impetuous , can not conform .

05. Learning the language base is important

If the foundation is not solid, the procedure developed is dangerous.
To use what you've learned in development.

06. When to see someone else's code?

Trying to figure out how to write code is far more difficult than writing software.
Beginners do not look at other people's Code

Draw the call relationship on paper and grab the main line .

07. How to Improve?

Have initiative. The desire to learn is stronger. Surf the internet to find other people's problems and improve for yourself.

08. Develop the ability to identify, think and solve problems

Error message, exception information
Develop the ability to identify, think and solve problems

This ability benefits a lifetime and does not change over time

the idea of programming in the

More intentions, more hands
Principles and mechanisms of program operation
The purpose of programming, the invocation of functions, the memory model

10. Learn the vein first, then learn the foliage

Day01CoursesJavaBasic1.What is a computer program?

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

Instruction: The communication between the two parties in each other can be recognized language to complete a very small work.

2.JavaWhat are the relevant technologies?

Parsing: javase ( desktop application ) Java EE ( website ) javame ( mobile app ), has now been Android replaced, IOS (object-c)

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) {

The main method is The entry for the Java program

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

}

}

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

}

5.Escape Character

\ n: line break

\ t: a series of spaces

6.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.

7.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

8.in theMyEclipsein creating aJavaProject

Project name to specification:day01_0100

Package name naming specification:cn.happy

Class name specification: Capitalize first letter

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.

9.How to adjustMyEclipsethe font size in

Find Windows→Preferences→ input Fonts in the menu

10.JavaProject Organizational Structure

The package Explorer

Classes to manage multiple different functions

In the Package Explorer, a folder is formed on the hard disk every point you hit

The Navigator (Navigator)

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

11.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 the

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 item, then Browser

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.

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

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

When the double quotes are missing, the error is described as follows

Hello cannot be resolved(cannot be parsed)

Encountered an error, from the strategic contempt of him, from the tactical attention to him.

13.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 by the JVM(Java virtual machine) for the second time and compiled into CPU code that can be recognized

Learn the first article of Java

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.