All pastes #768647 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-10 19:36 UTC
rendered paste body
class MethodOne {

	String name;

	// A method

	String setName(String n) {
	name = n;
	return name;
	}

}

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

		MethodOne mo = new MethodOne();
		MethodOne mo2 = new MethodOne();

		String nameSet;
		
		// set the name using the method defined setName
		
		nameSet = mo.setName("David");
		
		// PRINT THE RESULT
		
		System.out.println(nameSet);

		// set the name using the method defined setName
		
		nameSet = mo2.setName("Steve");
		
		// PRINT THE RESULT

		System.out.println(nameSet);
	}
}