Difference - What is Program Arguments and VM Arguments | Java Programming Tutorial

Publicado el: 18 enero 2020
en el canal de: TechTalk Debu
8,889
94

#Program vs #VM #Arguments

GitHub Account for Free Code download: https://github.com/admindebu
Follow me on FaceBook:   / techtalkdebu  
Instagram: techtalk_debu
LinkedIn :   / debu-paul  

if you like my video, please subscribe to my channel and share the video


First of all, there are two arguments: 1. Program argument and 2. VM Argument
Program Argument: Program arguments are arguments that are passed to your application, which are accessible via the "args" String array parameter of your main method. Example: any program related value or logging level information, etc we passed through program argument.
VM Arguments: VM arguments are arguments such as System properties that are passed to the JavaSW interpreter. Basically, this is the instruction to the JVM “do something”.You can do things like control the heap size, etc. They can be accessed by your program via a call to System.getProperty() as you described.

Code :
package com.techtalk.debu;

public class ProgramVsVMArgument {

public static void main(String[] args) {

// Program Argument pro1 pro2 pro3
System.out.println("Program Arguments:");
for (String arg : args) {
System.out.println("\t" + arg);
}

// VM Argument : -Dproperty1=techtalk -Dproperty2=debu
System.out.println("System Properties from VM Arguments");
String property1 = "property1";
System.out.println(property1 + " Value : " + System.getProperty(property1));
String property2 = "property2";
System.out.println(property2 + " Value : " + System.getProperty(property2));



}

}

Thanks & Regards,
Debu Paul


En esta página del sitio puede ver el video en línea Difference - What is Program Arguments and VM Arguments | Java Programming Tutorial de Duración hora minuto segunda en buena calidad , que subió el usuario TechTalk Debu 18 enero 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 8,889 veces y le gustó 94 a los espectadores. Disfruta viendo!