

class Feb13 {
	public static void main(String[] args) {

	    // args hold the values passed in on the commandline
	    // the number of arguments passed on the commandline can be found using args.length
	    System.out.println(args.length)

	    // printing out the values in the array
	    for(int i = 0; i < args.length; i++) {
	        System.out.println(args[i]);
	    }

        // call a method (defined below) with no arguments and no return value
		printName();

        // call method, initializing the parameter with a integer literal
		printAge(3);

        // call method, initializing the parameter with the value of a variable
		int egg = 5;
		printAge(egg);

        // call method, initializing the parameter with the value returned from a function - str.length()
		String str = "hello";
		printAge(str.length());

        // print the value returned by getTen()
		System.out.println(getTen());

        // store (then print) the value returned by getTen()
		int value = getTen();
		System.out.println("value: " + value);

        // if we don't store the value returned by a function, it is lost
		getTen();

        // store the value returned by add(), then print the value
		int result = add(1,2);
		System.out.println("result: " + result); 

		result = add(0,2);
		System.out.println("result: " + result);

        // again we lost the value returned by add()
		add(0,2); 

		result = foo(1);
		System.out.println("result: " + result);
		
	}

	/* general form of a method

	access-modifier static return-type method-name(parameter list) {

	}
	*/

	static void printName() {
		System.out.println("My name is Joe");
	}

    // the parameter (age) is a local variable, initialized by the value passed
    // in when the method is called
	static void printAge(int age) {
		System.out.println("age: " + age);
	}

    // return a literal value
	static int getTen() {
		return 10;
	}

    // return the value of an expression (a+b)
	static int add(int a, int b) {
		if (a > 0) {
			return (a + b);
		}

		System.out.println("Hello Joe");
		return -1;
	}

	// return the value in bar
	static int foo(int a) {
		int bar = a + 7;

		return bar;
	}


}
