In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what is the construction of Java programming environment and the basic use of variables". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
What is software?
The basic component of software is the program that completes its function.
In daily life, a program can be seen as a description of the execution of a series of actions.
What is a computer program?
A collection of ordered instructions written to enable a computer to perform certain operations or to solve a problem.
Why java?
[1] most companies use
[2] Cross-platform
The history of Java development
[1] 1991 OAK (Oak Tree)
[2] in 1995, HotJava was developed and JAVA was officially withdrawn.
[3] in 1996, Sun released JDK1.0.
[4] 1998, released the most important JDK version in the history of java, JDK1.2.
[5] in 2009, Oracle announced the acquisition of sun
The characteristics of Java language
[1] portability: platform-independent features allow java programs to be easily ported to the network
[2] garbage collection: a term for java automatic memory release and automatic memory management.
What is the situation of recycling? The method of recycling because of insufficient memory? : System.gc ()
JDK, JRE and JVM
JDK:Java development kit java Development Kit
JRE+ tools + class libraries
JRE:java runtime environment Java Runtime Environment
JVM+ class library
JVM:Java virtual machine Java virtual machine, running Java program
How DOS commands are opened
[1] win+r cmd
[2] Program-- attachment-- Command prompt
Command
[1] switch drive letter
D: e: f:
[2] View file directory list
Dir
Dir / s view the list of files in all directories and subdirectories
Dir / pram s split-screen display
[3] change the current directory
Cd directory
Cd.. Return to the previous level
Cd / returns the root directory
[4] View help for a command
Help dir
[5] New folder
Md directory name
[6] New file
Copy con file name. With extension
Content
End of Ctrl+z
[7] View the contents of the file
Type file name. Extension name
[8] copy files
Copy source file directory destination file directory
[9] rename the file
Ren original file name new file name
[10] cut the file
Move source file directory destination file directory
[11] Delete a directory
Rd directory name, but only empty directories can be deleted
[12] Delete files
Del file name. The extension can only delete one file
Del *. * Delete all files in the current directory
[13] clear the screen
Cls
[14] exit
Exit
Temporary configuration of environment variables
Enter the following in the DOS window
Variable name: Path variable value:% JAVA_HOME%\ bin;%JAVA_HOME%\ jre\ bin; purpose: the purpose of configuring path is to execute java,javac commands on any path. Variable name: JAVA_HOME variable value: C:\ Program Files\ Java\ jdk1.8.0_151 (here is your JDK installation path, can be replaced) purpose: in order to simplify the configuration variable name of path: CLASSPATH variable value:.;% JAVA_HOME%\ lib\ dt.jar;%JAVA_HOME%\ lib\ tools.jar; purpose: the purpose of configuring classpath is to execute .class files in any path. The so-called classpath specifies the location of the .class file. When classpath is not configured, the java command will look for .class files in the current directory. If it cannot be found, it will report the following error. If classpath is set, it will look for .class from the path specified by classpath. If the value of classpath is not followed by a semicolon: look for .class files under the path specified by classpath. If you add a semicolon, first query the path specified by classpath, and then find out if there are .class files in the current directory. Note: classpath is usually configured to start with.;, indicating that the query is the current path.
Permanent configuration
My computer-> right-click-> environment variables-> configuration
Set three properties in the "system variable", JAVA_HOME,PATH,CLASSPATH (case does not matter), click "Edit" if it already exists, and click "New" if it does not exist.
The first java program
A keyword in a java program that defines a class. This word cannot be used to do anything else when writing code, but can only be used to define the class name of the program when the class / / HelloWorld. The class name can be customized. English is recommended. Pay attention to the capitalization of the initials. / / all java programs are written in classes. The following curly braces are used to indicate the scope of the class. Class HelloWorld {/ / represents a main method. It's the entrance to the program. Program entry: indicates that all code execution should start with the method. / / args can be changed to another name, or it can be String args [] public static void main (String [] args) {/ / to indicate the output of the program, and the contents in double quotes can be changed. System.out.println ("Hello World!");}}
Note:
[1] java is strictly case sensitive
[2] keywords are all lowercase
[3] symbol English half-width
[4] the code should have indentation, a tab key
[5] end the statement with a semicolon
[6] it is best to write one sentence of code per line
[7] curly braces appear in pairs
The process of writing Java
Write the source file-> compile the source file through the javac command-> execute the bytecode file through the Java command.
Javac needs to be compiled with the suffix .java, while the java command can be followed directly with the file without a suffix.
Javac Hello.javajava Hello
JVM working principle console printout
/ / output and newline System.out.println ("string"); / / 1. Ordinary characters: output as is 2. Escape character / / output does not wrap System.out.print ()
Escape sequence and binary conversion escape sequence in Java
[1] Octal escape 00 -\ 377
[2] hexadecimal escape\ u0000 -\ uffff
[3] escape character\ n\ t\\'\ "
Binary conversion
Binary 0Pol 1
Octal 0-7
Decimal 0-9
Hexadecimal 0-9 aaff
Variable
Usually, the location of this memory space can be found according to the memory address, and the stored data can be found. But the memory address is very difficult to remember, so we give this space an alias and find the data stored in the corresponding space by using the alias. A variable is a representation of a data storage space. The data it stores can be easily and quickly found through the variable name. Variables are a basic unit for storing data, and different variables are independent of each other.
Naming rules for identifiers
1. It consists of letters, numbers, underscores _, and $characters.
two。 You cannot start with a number.
3. Cannot be a keyword for java
4. Cannot be a literal true,false,null.
Naming conventions for identifiers
Variable specification: camel nomenclature
It is composed of multiple words, the first letter of the first word is lowercase, and the first letter of the latter word is capitalized.
Note:
1. Variables must be declared before they are used
two。 A variable with the same name cannot be declared within the same scope
3. Local variables must be assigned before they can be used.
Annotation
1. Single-line comment
two。 Multiline comment
3. Document comment
Note: the escape character processing time is earlier than the comment processing time, the escape character in the comment must be correct.
Document comment generation command
Javadoc options file / / command option file javadoc-private-d doc-author-version Demo4.java
Options:
-private / / document comments of members with any level of access can be recognized, for example: public protected default private-package / / indicates public protected default recognized-protected / / indicates that public protected is recognized-public / / indicates the directory where the generated help document is located, automatically generates-author / / recognition generates @ author comments-version / / identifies @ version comments
This is the end of the content of "what is the basic use of Java programming environment and variables". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.