** Math Game! Play Integers in Space!


A+    A−    B  
Home
Algebra
Math Games
  • Decimals in Space
  • Fraction Balls
  • Integers in Space
  • Math Man
  • Number Balls
  • Geometry
    Interactive
    Trigonometry
    Jobs
  • Tutoring jobs
  • New York Tutoring Jobs
  • White Plains, NY
  • Westchester County, NY
  • Chicago Math Jobs
  • Philadelphia
  • Teacher Resources
    On FaceBook!

    How to Pass arguments from Command Prompt To Java

    public static void main (Sring[] args)

    This example assumes that you are comfortable using the windows command prompt as well as how compiling and running basic java files.
    First, use javac to compile the java class below.
    public class Arg{
    
    public static void main(String[] args){	 
    	System.out.println(args[0]);	
    	}
    
    }
    
     

    Example 2. Changing the Class and Parameters

    So, what if you don't want to print out the first argument in the command prompt? First, let's recompile Hi.java so that it prints the second argument that is passed,ie args[1].
     public static void main(String[] args){	 
    	System.out.println(args[1]);	
    	}
    
     

    Top