Organized memo in the head (Java --Control syntax)

My Java environment

for statement


for (Initialization statement,Conditional statement,Update) {
    //Iterative processing
}

do-while statement


do {
    ... //Iterative processing
} while(Control statement);

Omission of curly braces ({})

In the case of a while statement, only one statement is subject to repetition. (The ʻifstatement feels the same.) (If you write the following process using IDE, it will shift the indent, so it seems to be correct.) (Not one line, one sentence. Up to;`.)


int param = 0;
while (param < 3)
    System.out.println("param:" + param);
    param++;

Is the execution result

param:0
param:0
param:0
・ ・ ・

It becomes an infinite loop.

↓ is a compilation error.


do
    System.out.println("param:" + param);
    param++;
while(param < 3);

Recommended Posts

Organized memo in the head (Java --Control syntax)
Organized memo in the head (Java --Array)
Organized memo in the head (Java --instance edition)
Organized memo in the head (Java --Data type)
Organized notes in the head (Java-Exceptions)
Java control syntax
Java control syntax
[Java] Control syntax notes
[Java] Summary of control syntax
Syntax examples often used in Java
Access the network interface in Java
Guess the character code in Java
Specify the java location in eclipse.ini
Unzip the zip file in Java
Notes on signal control in Java
Parsing the COTOHA API in Java
Call the super method in Java
Get the result of POST in Java
Try using the Stream API in Java
Call the Windows Notification API in Java
Memo: [Java] Check the contents of the directory
I tried the new era in Java
Memo: [Java] If a file is in the monitored directory, process it.
[Java] Use cryptography in the standard library
Java memo
Try calling the CORBA service in Java 11+
What is the main method in Java?
Break long slim syntax in the middle
How to get the date in java
The story of writing Java in Emacs
Console input in Java (understanding the mechanism)
Display message dialog in java (personal memo)
Regarding the transient modifier and serialization in Java
The story of low-level string comparison in Java
[Java] Handling of JavaBeans in the method chain
About the confusion seen in startup Java servers
The story of making ordinary Othello in Java
[LeJOS] Let's control the EV3 motor with Java
About the idea of anonymous classes in Java
ChatWork4j for using the ChatWork API in Java
A story about the JDK in the Java 11 era
The intersection type introduced in Java 10 is amazing (?)
The story of learning Java in the first programming
Measure the size of a folder in Java
Feel the passage of time even in Java
Automatically control the last column in JavaFX TableView
[Java] Read the file in src / main / resources
Display "Hello World" in the browser using Java
[Java] Judgment by entering characters in the terminal
Display "Hello World" in the browser using Java
Try using the COTOHA API parsing in Java
[Java] Memo on how to write the source
[Java] Something is displayed as "-0.0" in the output
Import files of the same hierarchy in Java
java anything memo
Java Silver memo
Partization in Java
java, maven memo
Changes in Java 11
Rock-paper-scissors in Java
Java SE 7 memo