About Java commands

What is a Java command in the first place?

background

What kind of processing is done when a Java command is executed in the first place in business?

I looked it up.

How Java commands work

--The java command is a command to start the JVM --The JVM loads the specified class after startup and calls the class's main method -** java command syntax **

java fully qualified class name[Argument argument...]

Details

--The arguments that follow the class name are called ** "startup parameters" ** or ** "command line arguments" **. --Multiple startup parameters can be specified by separating them with a space. --Startup parameters are optional and can be omitted --The data specified as the startup parameter is stored in the String array object by the JVM and passed as an argument of the main method.

Flow when executing java command

--Launch the JVM --Find and load the specified class from the classpath --Create a String type array object to store startup parameters --Execute the main method with a reference to the String array type object that holds the startup parameters as an argument.

example


public class Main{
   public static void main(String[] args) {
    System.out.println(args[0] + " " + args[1]);
   }
}

command

$ java Main red blue grenn

[Dokojava](https://www.google.com/url?sa=t&rct=j&q=1esrc=s&source=web&cd=1cad=rja&uact=8&ved=2ahUKEwj5qq3KlMPsAhWlIqYKHcW1Cl4QFjAAegQIARAC&url=https%3AgQIARAC&url=https Let's actually try it with iJ_00k-0ctsUdsFTbwDe)!

Referenced article (Thank you always.)

[Even beginners can easily understand] Summary of how to use java commands

Recommended Posts

About Java commands
[Java] About Java 12 features
[Java] About arrays
Something about java
Where about java
About qiita_org commands
[Java] About interface
About Java class
About Java arrays
About java inheritance
About interface, java interface
About Javac commands
About java var
About Java literals
About Java log output
About Java functional interface
About class division (Java)
About [Java] [StreamAPI] allMatch ()
About Java method binding
[Java] About anonymous classes
About method splitting (Java)
About Java Array List
About Java Polymorphism super ()
About inheritance (Java Silver)
Ping commands in Java
About Java String class
About Java access modifiers
About Java lambda expressions
About Java entry points
About Java 10 Docker support
Personal summary about Java
[Java] About enum type
All about Java programming
About java abstract class
A note about Java GC
What I researched about Java 8
About an instance of java
What I researched about Java 6
[Gradle] About Java plug-in tasks
About Java variable declaration statements
What I researched about Java 9
[Java] About try-catch exception handling
About Java class loader types
[Java Silver] About equals method
[Java] About String and StringBuilder
Java
About =
About Alibaba Java Coding Guidelines
About Java class variables class methods
About Java Packages and imports
About abstract classes in java
What I researched about Java 5
About Java static and non-static methods
How about TECH ACADEMY ?? [Java course]
[Introduction to Java] About lambda expressions
About fastqc of Biocontainers and Java
About Lambda, Stream, LocalDate of Java8
[Introduction to Java] About Stream API
Learn about transaction savepoints (with Java)
[Java beginner] About abstraction and interface
About signature authentication with java 1st