TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Thursday, 9 April 2020

Java Command Line Arguments | Use Of Command Line Arguments In Java

Java Command Line Arguments

The java command-line argument is an argument i.e. passed at the time of running the java program.
The arguments passed from the console can be received in the java program and it can be used as an input.
So, it provides a convenient way to check the behavior of the program for the different values. You can pass N (1,2,3 and so on) numbers of arguments from the command prompt.
Java Command Line Arugment | Use Of Command Line Arguments
Fig: Command Line Arguments

Example of command-line argument in java

    class CommandLineExample{    
    public static void main(String args[]){  
    System.out.println("Your first argument is: "+args[0]);  
    }  
    }       
     

   compile by > javac CommandLineExample.java  

   run by > java CommandLineExample pramod


    Output: Your first argument is: pramod

No comments:

Post a Comment