First day of the learning process
Java Overview "Computer-java Introduction"--------Java Classic Instance "Path environment configuration, HelloWorld"-------------Java Basics "keyword, identifier, comment, HelloWorld comment complete"
Ii. Overview of Java
keyboard Shortcuts :
CTRL + A: Select All Ctrl + C: Copy Ctrl + V: Paste ctrl+x: Cut
CTRL + Z: Undo ctrl+s: Save Windos+r:dos Command Run
Dos Command :
D: Drive letter Switch Dir: current directory file (clip) list display Md: Create directory Rd: Delete directory
CD: Enter the specified directory CD ...: Return to parent directory cd\: return root Del: Delete file (*.txt)
Exit: Exit DOS command Cls: Clear screen
Java features-cross-platform:
The Java language is cross-platform and the JVM is not cross-platform.
JRE:JVM + Class Library operating environment
JDK:JRE + Tools Development Kit
Summary: Software developed by the JDK must be run on the JRE and guaranteed across platforms by the JVM.
Third, Java Classic instance-helloworld
Environment Variables :
(1) The role of the PATH environment variable
Let the Javac and Java commands be used in any directory.
(2) Path environment variable configuration (master)
A: Modify Path only
D:\develop\Java\jdk1.7.0_45\bin; The previous path is added, separated by;
B: First create a java_home, then modify path
NEW: Java_home value is D:\develop\Java\jdk1.7.0_45 "JDK installation path"
Modified:%java_home%\bin; the previous path
Recommend the use of Plan B.
(3) configuration of CLASSPATH environment variables
Allows the specified class file to be accessed in any directory.
Tip: Configure one on the far left.;
The advantage of this is that it can be found and executed in the current directory first.
HelloWorld Source code:
/**This is the HelloWorld standard program for you to learn more about the full Java program code and comment style content includes: class, method, statement use;@author: Yu Junyong@version: v1.0 ideas: 1. Declare class with Class, class name is HELLOWORLDTEST;2, build main Main method, as the entry of the program, fixed format: public static void Main (string[] args) {}3, write output statement For output to achieve the integrity of the first program System.out.println ("actual output sentence"); Step: 1, class HelloWorldTest {}2, public static void main (string[] args) { }3, System.out.println ("actual output sentence"); 4. Correct merger*/ //Document Comments//This is the first Java program and a classic example of how Java begins to learn. Single-line Commentclasshelloworldtest{/*in the EditPlus application, blue represents the Java keyword; main is the entry for the Java program, and a program must have a Main method*/ //Multi-line comments Public Static voidMain (string[] args) {//output statement, printed to the DOS interface, the output is: Hello WorldSystem.out.println ("Hello World"); //The following code is used to illustrate comments for debugging programs// /*System.out.println ("Hello World"); System.out.println (' Day-day-up ');//This line double quotation mark System.out.println ("Good good study ');//This line double quote is incorrect System.ou T.println ("Hello Java"); System.out.println ("hard")//Line missing statement Terminator; SYSTEM.OUT.PRINTLN ("Study Java"); //*/ //single-line comments, multiline comments combined with }}
Summarize:
First, comments
1, note there are three kinds, single-line comment://
Multiline Comment:/* */
Document Comment:/** */
Note: Single-line comments can be nested, multiline comments, document annotations cannot be nested
Creative use: A multiline comment combined with a single-line comment allows for flexible management of the code, as shown in the output statement; Multiline comments can also be used to debug a program.
Code writing often occurs with an error:
1, keyword writing errors, the keywords are lowercase letters;
2, the class name is saved without regard to the suffix name, such errors occur: Demo.java.txt;
3, String/system first letter all need capital;
4, brackets do not pair, in writing, write directly pairing, and then add the middle part of the code;
5, class name, variable name, method name is not standardized, comments incomplete [professional quality].
Key words:
Are words in Java that are reserved for a particular meaning, all lowercase letters. where Goto, const is a reserved character, may be promoted to a keyword in later versions.
Identifier (zhi):
The name of the package, class, variable, method, constant.
1. Rules for identifiers:
Composed of 26 English characters "case", 1-9 numeric characters, _ and $;
Where numbers cannot be used to start identifiers;
cannot be the same as the keyword;
Strictly case-sensitive.
2, the identifier naming rules: see the name of the meaning; hump naming;
Package: Words are lowercase, multi-level package between. Connection;
Classes and interfaces: One word, first letter capital, multiple words, each word capitalized;
method, variable name: Single word, first letter lowercase, multiple words, first letter lowercase, then all the first letter of the words are capitalized;
Constants: All letters are capitalized, multiple words, and words are separated by _.
in HelloWorld Summary of errors appearing in :
1, hidden suffix name is not managed, there are a.java.txt naming errors;
2, Main method, main write Wrong (Mian);
3, System, the first letter of the string is not uppercase;
4, Chinese and English symbol inclusions, all the input are English characters;
5, all statements to; for the end of the logo, cannot but write, and must be in English mode;
6, the parentheses are paired, and need pairing.
First day of Java Foundation---