How to print message in command line arguments | Coding Startup

How to print message in command line arguments

How to Print Message in Command Line Arguments

100% Working Code and Projects.

if you need any help about project and Application Contact Shelly at:+917888361589.


See the code below :-

Java Code 1 :-

public class Hello {

    public static void main(String[] abheer) {
        System.out.println(abheer[0]);
       
   }

}

 
Explanation :- 
                                    In this, we have to give the value to program before running the program but after the compilation. This code will only run in cmd(Command Prompt) .

Java Code 2 :-

public class Hello {

    public static void main(String[] abheer) {
        System.out.println(abheer[0]);
     
   }

}





Explanation :- 
                                    As the program stores the data in the form of array. Now in this only the first word is printing and after space it is not recognizing. The value Abheer is stored in abheer[0] and abheer is not geting any memory.


Java Code 3 :-

public class Hello {

    public static void main(String[] abheer) {
        System.out.println(abheer[0]);
         System.out.println(abheer[1]);
     
   }

}





Explanation :- 
                                     In this program, the both value are geting memory. Moreover , we are using System.out.println() that's why its printing the value in next line.













Code Startup

Author & Editor

0 Comments:

Post a Comment