wellnwill Marathahalli Bangalore

Command Line Arguments


These arguments are passed to main method of the executing class. The type of command line arguments are always string.

class Test240
{
public static void main(String g[])
{  
System.out.println("main starts");
for(int i=0;i < g.length;i++)
{
System.out.println(g[i]);
}
System.out.println("main ends");
}
}

Scanner class


import java.util.Scanner;  
class Test242
{  
 public static void main(String args[])
 {  
    Scanner scn=new Scanner(System.in);  
    System.out.println("Type your name");  
    String name=scn.next();  	
    System.out.println("Type your id");  
    int id=scn.nextInt();  
    System.out.println("ID:"+id);
    System.out.println("name:"+name);  
 }  
}   

Footer with Map