Objective
Process Control statement:
In the process of executing a program, the order of execution of each statement has a direct effect on the result of the program. That is to say, the process of the program has a direct impact on the running
Java Branching Structure-if...else/switchSequential structures can only be executed sequentially, not judged and chosen, so branching structures are required.There are two types of branching structures in Java:
if statement
Switch
casts of data types
public class example2{
int i=97;
Char c= (char) i; Cast of type
System.out.println ("c=" +c);
}
Hundred Record Entry dialog box
Import javax.swing.joptionpane;//dialog box to eject the method in the required package
public class
Multiple choice structure switch statement
In java, a switch statement is provided for the multi-path Branch selection process. The switch statement selects one of the multiple operations to run based on the value of an expression. The syntax
If statementAn If statement contains a Boolean expression and one or more statements.GrammarThe syntax for the IF statement is as follows:if (Boolean expression){If the Boolean expression is true, the statement executed}If the value of the Boolean
Multi-Select structure switch statement
In Java, a switch statement is specifically provided for the multipath branching selection process, and the switch statement chooses one of the multiple operations to run based on the value of one expression.
If statementAn If statement contains a Boolean expression and one or more statements.GrammarThe syntax for the IF statement is as follows:if (Boolean expression){If the Boolean expression is true, the statement executed}If the value of the Boolean
The Chinese meaning of Switchkeyword is the meaning of switch and conversion, and the switch statement is especially suitable for making a set of variables equal inference in the conditional statement, which is much clearer than the if statement in
The syntax of a switch structure (switching statement)switch (expression) {---> type int, charCASE constant 1:---> Casestructure can have multipleStatement Block 1break;---> program jump out of the switch structureCASE constant N: values of--->
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.