[Java] <1> language environment and java language environment
I. Basic understanding
When I heard about the term "Java" for the first time, I always thought that he was so tall and unmeasurable. In this way, his impression has been kept until now ...... Because of the soft test, you have to cultivate your feelings with Java in advance! I know from a preliminary understanding that I can also grow taller.
Looking at the simplest HelloWorld example, we found that the big framework is actually fixed, and the difference is that the call between various constructors and methods is added to it.
Example:
The first sight of this example reminds me of class C language. Why do I think of class C language? Because it is connected to the semicolon again! For beginners of Java, we should pay attention to the following points during program knock:
- The class name and file name must be consistent, that is, the file name behind the class you define must be consistent with the file name saved in this example;
- To make it a good habit to complete braces, when writing the left half of braces, you need to form a good habit to complete the right half! This not only forms a complete framework, but also avoids program errors caused by small errors;
- Case sensitivity
- The first letter of the class name must be capitalized;
- The first letter of the variable name and method name must be in lowercase;
- Follow the camper ID. I believe this is not a stranger! Because this is applicable to all languages, names composed of words must be capitalized apart from the inherent rules.
- You must be familiar with the data type. For example, HelloWorld belongs to the string type. Therefore, you must add double quotation marks to conform to the specifications;
- Format orchestration is a very important issue. You must pay attention to the front and back indentation. (Tip: Remember to use the Tab key !)
Ii. Core Mechanism
For example, after reading this article, what language is java? What would you do! I hesitated when I first watched this part of the video. However, when I watched all the pictures, I said that the compilation was done. Of course, it was a compilation language. However, if I thought so, it would be a big mistake, when typing the "HelloWorld" applet, we execute the following command in the command prompt:
Why is java executed after javac execution? In fact, the implementation process of javac is simply to compile it into a class you know, And the next javac process is to truly translate it into a suitable system through a virtual machine. There is an additional layer of class here, which seems to reflect the idea of hierarchy! I feel familiar with it in an instant!
When you hear this name, you will understand its role. It must be responsible for garbage collection. In fact, this function is very convenient for programmers, because the process of writing code in java reduces the intersection of sentences and garbage. During the process of calling a function, after you complete the required functions, you can leave the rest of the work alone, because garbage collection is used to clean up the residue! In fact, it is equivalent that you go to the restaurant to eat, and after eating, you can pat your ass and leave without worrying about the remaining residue, but it is different to eat at home, all the pots and pans after eating need to be cleaned up, which is actually a meaning. I finally talked about it! It turns out to be a lot of food! Hey!
Iii. Environment Variables
To Understand java, this should be the third time we have come into contact with the "environment variable! I don't remember why I first got in touch with the class. I was very impressed that I modified the class content for the first time and didn't use it, an error occurs when updating the IP address, which always does not meet the requirements. Finally, the environment variable is modified to solve the problem. This time, the environment variable is exposed again, the so-called environment variables only provide convenience for the system. Just like the filters in our mailbox, news emails do not want him to disturb himself in daily targets, therefore, you can set a filter so that the filter can automatically find its own location when receiving emails. The most common use of environment variables is the software's fixed storage path.
In java, two environment variables are required:
- Path: The path to be searched when running commands in windows. If my installation path is D: \ Java \ jdk1.8.0 _ 05 \ bin, you can store this path in path, remember that ";" is very important. In fact, it also has a priority principle. When there are too many stored paths in the path, we can consider the Limitation Principle to determine who is the boss;
- Classpath: the path of the class to be searched for during java compilation and running. For convenience, I just created a java folder on the E drive, so it is relatively simple. Here, I keep in mind that Chinese characters should not appear during the creation of storage paths, avoid unnecessary problems.
Iv. Summary
Although I am still not familiar with Java, I have learned that Java is a pure object-oriented idea. objects are the core of Java. in Java, "Everything is an object ", I still haven't understood the soul of Java. Continue to understand it!
What is the java language environment?
Jdk
Jdk contains jre and jre is the java Runtime Environment,
JAVA is a programming language for network environments.
JAVA is an object-oriented programming language applicable to the network environment.