Good evening everyone! This article is my first post. If you find any mistakes, please let me know. Thank you.
Instruction execution statements are statements for calling various instructions provided by Java. To give you an example, the easiest thing for anyone studying Java is
System.out.println();
public static void main(String[] args) {
System.out.println("Hello World"); //Instruction execution statement
}
Hello World
is. In JavaScript document.write() It's similar to!
Let's see more! !!
int m = Math.max(①, ②);
public class Main {
public static void main(String[] args){
int a = 10;
int b = 20;
int m = Math.max(a, b); //Instruction execution statement
System.out.println(a + "When" + b + "And the bigger one..." + m)
}
}
10 and 20 whichever is larger...20
int r = new java.util.Random( ).nextInt(①);
public class Main {
public static void main(String[] args){
int r = new java.util.Random().nextInt(100); //Instruction execution statement
System.out.println("The number you chose is..." + r + "is not it?");
}
}
The number you chose is...23, right?
String s = new java.util.Scanner(System.in).nextLine();
public class Main {
public static void main(String[] args){
System.out.println("Please input your name");
String name = new java.util.Scanner(System.in).nextLine(); //Instruction execution statement
System.out.println("Welcome," + name + "San!")
}
}
Welcome, Taro!
System.out.println, which is often used when using java, is also one of the statements of instruction execution. There are still other instructions for executing instructions. Personally, I was impressed when I first used the instruction to generate random numbers. It's fun to be able to do what you can't do. Thank you for watching until the end.
Recommended Posts