Dark Horse programmer-java basic knowledge + Environment setup and variable configuration, dark horse-java

Source: Internet
Author: User

Dark Horse programmer-java basic knowledge + Environment setup and variable configuration, dark horse-java

I. doscommand

Software: a collection of computer data and commands organized in a specific order.

Interactive Mode: graphical interface and Command Line Mode

Dir directory display files and subdirectories

Cd change directory changes the current path (to the specified directory)

Md make directory create a new sub-directory (folder)

Rd remove directory delete a sub-directory (folder)

Cd .. return to the previous folder

Cd/return root directory (Disk)

Del delete files (do not go to the recycle bin) del *. txt (delete all txt files in a directory)

Rename

Note:

Rd deletes a sub-directory (folder) (to ensure that there are no files in the directory, if there are files, the "rd directory" command cannot be used directly, then you can run the del command on the directory, and then use the rd command to delete the directory. The advantage is that you do not need to change the path back and forth)

For example, if C: \ abc \ op has a TXT file, delete the op folder.

Method 1:

Delete the text file C: \ abc \ op> del 1.txt first

Return to abc C: \ abc \ op> cd ..

Delete op C: \ abc> rd op

Method 2: run the del command directly under abc.

C: \ abc> del op will prompt you to delete the files in the directory.

C: \ abc> rd op

Deleting the op directory is simpler than method 1.

Ii. Java language Overview

1. java is a language that allows users to transmit applications from a remote server to a local machine over the Internet and execute them.

Features: Object-oriented, secure and reliable, unrelated to the platform (operating system), and portable

Principle: Install a Java Virtual Machine (JVM) on the platform where you need to run the Java program. The JVM parses and runs the Java program. (Virtual machines have different versions based on the operating system)

2. Three technical architectures of java:

J2EE Enterprise Edition: a solution for developing applications in an enterprise environment, such as Server Jsp.

J2SE Standard Edition: it is a solution for developing common desktop and morning applications. It can complete the development of some desktop applications.

Small edition: a solution for developing electronic consumption products and embedded devices. It is mainly used in mobile apps.

After Java5.0, change the name to JavaEE ..

Iii. Environment Construction

Download and install JRE, JDK, and configure environment variables.

JRE: Java Runtime Environment, including the Java Virtual Machine and core class libraries required by Java

JDK: Java Development Kit, including Development tools and jre. Development tools include compilation tools javac.exe.pdf and packaging tools jar.exe.

1. Why does JDK include JRE?

First, the developed program always needs to run to see the effect;

Second, the development tools in the bin directory under JDK are written in Java and must be supported by virtual machines in the runtime environment.

2. Why should I configure java environment variables?

After JDK is installed, execute the javac.exe program in libusing the command line,

F: \ jdk1.6.0 _ 24 \ lib> javac. If exit to jdk f: \ jdk1.6.0 _ 24 \ lib> cd.. then execute javac.exe, F: \ jdk1.6.0 _ 24> javac.

Q: Do I need to go to the lib directory every time I develop a program? The requirement is that the command can be executed in any directory.

The answer is: Tell the system the path where the command tool is located and find it by the system. It is more convenient to use the command, that is, java environment variable configuration.

3. Configuration skills

In some cases, the jdk drive letter or name will be changed. Each time the drive letter or name is changed, the path must be changed once to prevent misoperation of other configurations. You can use one configuration technique:

(1) Use a new environment variable a to record the changed drive letter and file name: java_home = F: \ jdk1.6.0 _ 24

(2) obtain the value of a in path, and add the unchanged bin path = % java_home % \ bin

Note: The % symbol is used to dynamically obtain an existing environment variable value, so that you only need to change the value.

4. Temporary configuration of Environment Variables

Use the dos set command (view or set the environment variable value)

C:> set path: view the value of path.

C:> set path = haha: set the path value.

In this case, the path value is haha, but the set path in the dos window is opened again in the "Start" menu, or the previous value.

This shows how to configure environment variables in dos, which is only valid in the current window. However, if you use the start command to open a new dos window after configuration, the window will follow the environment variable value of the original window.

In this configuration, the previous value of path is missing and only the new value is configured. What if I want to add a new value based on the value of path environment variable?

You can use dynamic variable values: C:> set path = haha; % path %

4. Composition of Hello World

Keywords: words with special meanings granted by the java language, such as class keywords, which can only be lowercase

1. Java writing specifications

A. The class name should contain meaningful words to increase readability.

B. The class name is composed of a single letter. Each word is capitalized.

C. Braces define class name intervals

D. The content in the class should have a step (usually use the tab key)

E. All methods must end;

2. The fixed primary function is written as public static void main (String [] args) {}to ensure the independent operation of the class. Why?

Because the java command calls the virtual machine, the virtual machine uses the content of the lower-layer windows, and runs the specified class. In the class, it first finds the specified function main and runs it. That is to say, the virtual machine calls the main function in the specified class and runs the code. The main function is the entry of a program to ensure that the class runs independently. Write the main function in the class to be run.

V. Java document comments

In JDK, javadoc.exe can extract the comments of all documents in the program into a web page, which is the description of the program.

1. Representation of document comments:/***/unique to java

In comments: // used in a single row,/**/used in multiple rows. There cannot be multiple comments in multiple comments, or a single row comments, these two annotations are not interpreted and executed by JVM.

2. Purpose of the annotation: 1. Description 2. debugging program

When writing a program, you need to develop the habit of comments. You can sort out your ideas through comments and use code to reflect them, because code is only a form of reflection of thoughts.

When writing a new program:

1. Write comments first: a. requirements. Requirements: B. Steps c.

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.