JAVA simple understanding

Java development history

Java is a Sun (Stanford University Network) company founded in 1982. The main designer of Java is James Gosling, who comes from a Green consumer electronics project.

In 1995, sun released jdk1 t0

1998, jdk1 2. Change its name to Java2, then jdk1 3, 1.4 jdk1. 5. Change its name to Java 5.0, we use the latest version of jdk1.0 8 jdk18.

 Java language features:

Simple, cross-platform, object-oriented, safe, multi-threaded, distributed, portable, interpretable, high-performance and dynamic.

Simplicity: Java language is similar to C++. It discards the error-prone aspects of C++. In particular, the Java language does not use pointers and provides automatic garbage collection, so programmers do not have to worry about memory management.

Cross-platform: The so-called cross-platform means that the software can run normally in any computer environment without being restricted by computer hardware and operating systems. In Java, your own virtual machine works well across platforms. It provides a bytecode barrier for the underlying hardware platform and operating system, making the Java language cross-platform. Compile once, run everywhere.

Object-oriented: Java is an object-oriented language that makes program development easier and easier to use. It has functions such as code extension and code reuse.

Security: Java's security can be guaranteed from two aspects. On the one hand, in the Java language, C++ functions such as pointer deletion and memory release are to avoid illegal memory operations. On the other hand, when creating a browser using Java, the language functions are combined with those provided by the browser itself, making it more secure.

Multithreading: Multithreading allows an application to have two or more threads at the same time to support transaction concurrency and multitasking. In addition to built-in multi-threading technology, Java also defines some classes and methods to create and manage user-defined multi-threads.

Distribution: Java language supports the development of Internet applications. Among the basic Java Application Programming Interfaces is a Network Application Programming Interface. It provides class libraries for network application programming, including URL, urlconnection, socket, etc. Java's RMI (Remote Method Activation) mechanism is also an important means of developing distributed applications.

Portability: The Java system itself is highly portable. The java compiler is implemented in java, and the java runtime environment is implemented in ANSI c. In addition, Java also strictly stipulates the length of each basic data type.

Note: The Java interpreter can directly run the target code instructions. Linked programs typically require fewer resources than a compiler, so the programmer can spend more time creating the source program.

High performance: If the interpreter is not slow, Java can directly translate object code into machine instructions at runtime. The speed of translating object code is no different than C/c++.

(Dynamic: Adapting to dynamic environments is one of the design goals of the Java language. The classes required by the Java program can be dynamically loaded into the running environment, or the required classes can be loaded through the network. This is also conducive to software upgrades.

JDK, JRE and JVM overview:

 JDK: Provides JDK for Java developers, including Java development tools and JRE.

JDK: JRE + Java development tool.

Java programs developed using JDK are handed over to JRE for running.

Development tools include compilation tools (javac. Exe) and running tools (Java. Exe).

 JRE: Includes the Java virtual machine and the core class libraries required by Java programs. JRE: JVM + class library.

 JVM: Java virtual machine. Java programs need to run on a virtual machine. Different platforms have their own virtual machines.

Download, installation and configuration of java development environment:

Download: Download address: www.oracle.com Com or www.sun.com Com, install the latest version of JDK (it is best not to install it in a directory with spaces and Chinese characters).

Set windows environment variables. Path/classpath Select an appropriate text editor or use an integrated development environment.

What are environment variables:

By default, the system looks for the path of the application.

How to configure environment variables:

Find My Computer on the desktop, right-click, click Properties, and find Advanced System Settings in System.

Click "Environment Variables".

Find the system variables and create a new variable named Java_Home. The value of this variable is the path where you installed the JDK.

Click the steps above to create a new variable %Java and set it to %Java_HOME%\bin. It must be in the bin directory, then confirm completion. Open the CMD command window, enter javac and Java, and verify whether it is successful.

 Java naming standards

CamelCase nomenclature:

Class name: Capitalize the first letter of each word: studentscore.

Variable name: the first character is lowercase, and the first letter of other characters is uppercase: studentname.

Method (function) name: the first word is lowercase, and the first letter of other words is uppercase: studentmethod();

Constant: In all caps: PI.

Please pay attention to the general principles of naming: letters, numbers,, $, and numbers cannot begin. Look at the name and meaning.

 The core mechanism of Java:

Java virtual machine

 Java garbage collection

Simple java CMD command:

 Java - version: View the Java version.

 Java - verbose: This parameter can display the detailed loading process when the JVM is started, so as to understand which development kit (JDK) is being used. It is mainly suitable for situations where there are multiple jdk's on the machine.

Guess you like

Origin blog.csdn.net/hy123154/article/details/124318391