Java Learning Diary (1): Introduction to Java

This series is a record of my learning situation, part of the content comes from the teacher's courseware. This article is only used as my own study notes, all the content only represents personal opinions and may not be correct. Dialectics are welcome.



Today's learning content

计算机的历史
计算机的组成
计算机语言的简史
dos介绍
Java语言介绍
JDK的安装及环境配置Java注释

After sorting out several important knowledge points:

低级语言和高级语言的特点和区别
编译型语言和解释型语言的区别
二进制的特点及转换
常用的DOS指令
JDK、JRE、JVM
Java环境配置,path、classpath、java_home的配置内容

1. The characteristics and differences between low-level languages ​​and high-level languages

Low-level languages : such as assembly language, machine language, and binary language, which are closer to low-level programming without compiling and parsing, with high execution efficiency and fast speed. Programming and debugging are difficult and time-consuming.

High-level language : relies on compilation and analysis, which is closer to human language logic, has high readability, simpler programming and debugging, high development efficiency, and lower execution efficiency and slower speed than low-level languages. In addition, high-level languages ​​depend on the operating environment, and an imperfect operating environment or inconsistent versions will cause the program to fail to execute.

2. The difference between compiled language and interpreted language

Compiled language : The written source code is compiled into binary code that can be run directly by the computer at one time. It is separated from the development environment when running, and has high operating efficiency and poor portability. Generally, it cannot be transplanted to other platforms.
Compiled language execution process
Interpreted language : compile sentence by sentence, write one sentence and compile one sentence. Every time it is run, the source code needs to be interpreted sentence by sentence into machine language and executed, which is inefficient. As long as there is a corresponding interpreter, it can be interpreted and executed with high portability.
Interpreted language execution process


Third, the characteristics and conversion of binary

In the binary number system, each 0 or 1 is a bit, called a bit.

Converting decimal data to binary data : Use the method of dividing by 2 to obtain the remainder (division):
Convert decimal data to binary data
Converting binary data to decimal data : Using the 8421 coding method (bit weight):
Convert binary data to decimal data
Binary calculation method for negative integers :
(1) Seek first Get the binary
(2) of the positive integer corresponding to the negative integer and add 1 to the result.


Four, commonly used DOS instructions

cd command: change the current directory or enter the specified folder
cd [drive letter:][path name][subdirectory name]
cd… return to the previous directory
cd \ or cd / return to the root directory, it is recommended to use cd
Note: if you need to access For the directory files in the non-current root directory, you should enter the drive letter first, press Enter, and then use the cd command
such as: d: switch drive letter d drive
*cd programs enter the programs directory

md command: create a directory
make directory
md drive letter: <folder name>
md myFile create a myFile folder in the current directory
md myPhoto\aaa\bbb create a myPhoto\aaa\bbb multi-level directory in the current directory
Note: md command also You can create folders beginning with.

dir command: list the files and folders in the current directory
dir [drive letter:][directory path] [/p] [/s] [/w] [/o]
/p page to display the next page content, press any Key to view the next screen
/s Display all files in all directories and subdirectories
/w Widescreen display
/o Sort order display
Example: dir /s
ctrl+c Terminate program operation

copy command: copy one or a group of files to the specified disk or directory
copy <source file path> [target path]
copy a.txt d:\myFile copy a.txt file to d:\myFile folder
copy myFile myPhoto only Copy all the files in the myFile folder to myPhoto, excluding the files in the subfolders.
If you want to copy all the files in the subfolders, you can use:
xcopy myFile myPhoto /s Cannot copy empty directories
xcopy myFile myPhoto /e Copy empty directories

rd command: delete empty directory
remove directory

rd [drive letter:][path name]<subdirectory name>
can only delete empty directories, not the current directory
rd myFile delete myFile directory
rd myFile\aaa can only delete aaa directory, not delete
Delete an empty folder with the name of the rd folder in the myFile directory .
Note: Cannot be used to delete non-empty folders.

del command: delete files
delete one or a group of files in the directory, you cannot delete the directory
del info.txt delete the info.txt file
del myFile* delete all the files in the myFile directory

Other commands
cls command: clear the screen
exit command: exit the dos command line
mspaint: open the drawing board
notepad: open the notepad


五、JDK、JRE、JVM

JDK (Java Development ToolKit, Java Development Toolkit) :

JDK = JRE + JAVA开发工具

JDK includes a series of Java tools such as Java runtime environment (JRE), java compiler (javac), debugger (java), database (jdb), and Java basic class libraries (API and jar package).

JRE: Java Runtime Enviromental, Java runtime environment

JRE= JAVA虚拟机+ JAVA核心类库

Java programs can only run under JRE. JRE includes JVM (Java Virtual Machine) and JAVA core class library and supporting files. Compared with JDK, it does not contain development tools-compilers, debuggers and other tools.

JVM: Java Virtual Mechinal, Java Virtual Machine
JVM is a part of JRE, a fictitious virtual computer system that can run Java bytecode. The JVM has an interpreter component that interprets its own instruction set (ie bytecode) and maps it to the local CPU's instruction set or OS system calls to realize the communication between Java bytecode and the computer operating system. Different operating systems use different JVM mapping rules, so Java is cross-platform.


6. Java environment configuration, configuration content of path, classpath, java_home

PATH environment variable: The function of
PATH environment variable is to specify the command search path. When executing a command such as javac to compile a java program under the command line, it will look in the path specified by the PATH variable to see if it can find the corresponding command program. We need to add the bin directory under the jdk installation directory to the existing PATH variable. The bin directory contains frequently used executable files such as javac/java/javadoc, etc. After setting the PATH variable, it can be in any directory Execute tools such as javac/java.

D:\java\java7\jdk1.7.0_21\bin;
Path = %JAVA_HOME%\bin;

CLASSPATH environment variable: the
role is to specify the class search path, to use the compiled classes, of course, the premise is to be able to find them, JVM is to find classes through CLASSPATH. We need to set dt.jar and tools.jar in the lib subdirectory of the jdk installation directory to the CLASSPATH. Of course, the current directory "." must also be added to this variable.

D:\java\java7\jdk1.7.0_21\lib
classpath =.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar

JAVA_HOME environment variable:
point to the jdk installation directory, Eclipse/NetBeans/Tomcat and other software can find and use the installed jdk by searching for the JAVA_HOME variable.

JAVA_HOME = D:\Java\jdk1.7.0_80

How to download the historical version of java JDK on the official website
http://jingyan.baidu.com/article/9989c746064d46f648ecfe9a.html


Guess you like

Origin blog.csdn.net/qq_37733862/article/details/109235032