Sunday, February 19, 2017

Write a JAVA program give example for command line arguments

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

output:
>java CommandLineExample 2 5 7
Your first argument is: 2
Your Second argument is: 5

Your Third argument is: 7

No comments:

Post a Comment

Write a JAVA program to sort an array of Strings

import java.util.Scanner; public class SortStrings {     public static void main(String[] args)     {         int n;         String t...