First, the Java environment configuration
1. Open My Computer--Properties--advanced--environment variables
2. New System variables Java_home and Classpath
Variable name: java_home
Variable value: The path through which the JDK file resides
Variable name: CLASSPATH
Variable value:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;
3. Environment variables for new "Path"
Variable name: Path
Variable value:%java_home%\bin;%java_home%\jre\bin;
Second, trial
1. Create a new text document and change the name to Texthelloworld.java (note that the hidden file extension in the file option is selected as the display)
2, in which enter
public class texthelloworld{
public static void Main (string[] args) {
System.out.println ("Hello world!");}
3. Hold down SHIFT and right-click on this page to open a command window and enter Javac Texthelloworld.java
4. Input Java Texthelloworld in command interface to display the contents of the output
Third, basic data structure
Identifiers: All the places you need to name yourself are called identifiers.
Java programming the naming of strict case-sensitive identifiers cannot be duplicated with a keyword
Reserved words: Goto CONST
Rules:
Identifiers are alphabetic (case), _, $, and cannot start with a number
Code specification: Hump Naming method
Null: Empty
var s = null;
Java Basic data type: cannot =null;
four types eight:
1, Integer type
byte 2 of 8 square (value range--<-128~127>)--2 bytes
Short 2 of 16 square--4
int 2 of 32 square--6
long 2 of 64 square--8
2, floating-point type
Float 7 digits after the decimal point--4
double 11 digits after decimal point--8
3, type bool
Boolean (only two values, true, False)--1
4, character type (with single quotation mark)
char--2 bytes
char a = ' Q ';
5. String (in double quotes)
String
String s = "Hanqi";
Java reference type (object):--Can be =null
All the classes
All the interfaces
All the arrays
Assigning values to variables
char c = ' a ';
char c = ' word ';
char c = 98;----ASCII
char c = ' \ n ';
char c = ' \u0061 ';----Unicode encoding
Define an integer variable by default to int
Defines a floating-point variable that defaults to double
Type conversions:
Double float long int char short byte
When a char short byte is evaluated, the value defaults to int
Implicit conversion (low-to-high), explicit conversion (high-low)
Operator:
arithmetic operators: +-*/% + +--; a++: First assignment in self-Add. ++a: The first self-added assignment; a+=4 equals a=a+4.
relational Operators:> < >= <= = = =!
logical operators:! & (and, and) && ( short-circuit operator, false-false) | | | (True and True) ^ (XOR)
xor operator: converted to binary form to compare each digit, not the same as 1, the same as 0
bitwise operators:>> << >>> (unsigned right shift)
assignment Operator: = = = = *=/=%=
string Join operator: +
Note: In the output, as long as there is a parameter is a string, the entire output is a string
ternary operator (expression) (Trinocular operator): Boolean value 1: value 2 before expression is true, execution value 1, if False execution value 2
Summary: In the environment configuration must be aware that the folder extension can not be hidden, I was hidden and then the file cannot be found, there is the output
Public class texthelloworld{publicstaticvoid main (string[] args) { int a=3; System.out.println (a+ +); System.out.println (+ +a); }
The result is 3,5
Java environment configuration, trial and basic data structure