/*************************************************/
String b= "";
String c= "";
String to char a, B is a variable
Char A=b.charat (0);
String vs. string comparison returns a Boolean type value
Boolean d= (c.equals (b));
/************************************/
Input
Refer to the scanner feature first
Import java.util.Scanner;
Get memory space in a function
Scanner scan=new Scanner (system.in);
Digital input A is a variable
int A=scan.nextint ();
String input A is a variable
String a= Scan.nextline ();
/**********************************/
Output
System.out.println ();
/************************************/
Referring to random decimals the default type is double and needs to be strongly converted to int,m uppercase, which is a random number within the reference 10
int a= (int) (math.random () *10);
In java, the squared B is a, b, and the square m is Capitalized.
int C=math.pow (a, b);
A to b, (a to a,a turn a, must be Strong)
A to b, turn a into a byte type plus a
Char a= ' a ' +1;
A to a minus the "a" can be a variable
Char "a" = (char) ("a"-32);
A to a plus the "a" can be a variable
Char "a" = (char) ("a" +32);
/*******************************/
Type
Byte//minimum Shaping
Short//medium Plastic
Int//common Shaping
Long//maximum Shaping
Float//single-precision Decimal
Double//dual Precision Decimal
Char//byte type
Boolean//boolean Two-value true true, false false
String//type
Type implicit conversion Low-turn-high
High turn to low cast
Special Type Special Conversion
/******************/
Move right to Left
A<<b//a*b left Shift
A>>b//a/b Right Shift
/****************************************/
loop, 4 Loops One for, one while,do while, advanced loop
Circular concluding sentence;
Break;//end Loop Body
Continue;//end of this cycle
For loop
For (condition 1; judgment; condition 2) {
Loop body
first, the condition 1, in the execution of the judgment, in the execution of the loop body, the final execution condition two, in the judgment, in this loop
}
While loop, first judge, in the execution loop body, in the count, in the judgment, in this loop with the For loop can be converted to each other
While (judgment) {
Execution Loop Body
Count
}
Does while loop, first executes the loop body, in the judgment, executes the loop body, does while executes only once the loop body more than the while loop
do{
Loop body
}while (judging)
Advanced Loops
For (subscript; Array) {
Used only to iterate through an array
Can only access cannot assign value
}
/****************************************/
If judgment, switch selection
If judgment, else vice versa if otherwise
If (judgment) {
Evaluates to True to execute
}else{
Evaluates to False to execute
}
Switch selection
Switch (condition) {
Case condition 1://conditions to be the same as condition 1 to perform condition 1 code behind
Break;//condition 1 Execution complete out of the selection
Case condition 2://condition to be the same as condition 2 to execute condition two behind code
Break;//condition 2 execution complete out of selection
Default://no rain conditions conforming to the execution
Break;//perform Pop-up Selection
}
/**************************************************/
A summary of Java basics