Java instruction execution statement

Introduction

Good evening everyone! This article is my first post. If you find any mistakes, please let me know. Thank you.

What is an instruction execution statement?

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
}

result
Hello World

is. In JavaScript document.write() It's similar to!

Let's see more! !!

Compare the two values ​​and substitute the larger one

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)
  }
}
result

10 and 20 whichever is larger...20

Instruction to generate and assign random numbers

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?");
  }
}
result
The number you chose is...23, right?

Accepts one line of input from the person who entered the character

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!")
  }
}
result
Welcome, Taro!

Finally

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

Java instruction execution statement
What I learned in Java (Part 3) Instruction execution statement
Java for statement
Java switch statement
Java study # 3 (type conversion and instruction execution)
[Java] for statement, while statement
[Java] for statement / extended for statement
(Memo) Java for statement
Parallel execution in Java
Java review (2) (calculation, escape sequence, evaluation rule, type conversion, instruction execution statement)
Java debug execution [for Java beginners]
[Java] Basic statement for beginners
[Practice! 】 Execution of SQL statement
Java programming basics practice-for statement
[Java] Spring AOP execution order
☾ Java / Iterative statement and iterative control statement
Java tips --Spring execution Summary
Java programming basics practice-switch statement
External process execution in Java
Execution environment test after Java installation
[Java] Basic types and instruction notes
[Java] Branch enum with switch statement
Java learning memo (while statement, do-while statement)
[Java] Really scary switch statement story
Java
Java study # 4 (conditional branching / if statement)
IDE (eclipse) debug execution, step execution (Java)
Java
Java, if statement / switch statement starting from beginner
[Java] How to measure program execution time
[Java] Flow from source code to execution
Java, for statement / while statement starting from beginner
Basics of java basics ② ~ if statement and switch statement ~