Port of schuchert.wikispaces.com


JBoss_AOP_Example_3

JBoss_AOP_Example_3

Predict the Output

Source files are here: JBossAOPExample3src.zip. If you need instructions on what do with these files, try here.

Have a look at the following Java files and, as before, predict the output.

Main.java

package ex3;

public class Main {
	public static void main(String args[]) {
		Address a = new Address();
		Dao.save(a);
		a.setZip(null);
		Dao.save(a);
		a.setZip("75001");
		Dao.save(a);
		Dao.save(a);
	}
}

Dao.java

package ex3;

public class Dao {
	public static void save(Object o) {
		if (o != null) {
			System.out.printf("Saving: %s\n", o.getClass());
		}
	}
}

Address.java

Address is unchanged from the previous example. It is a simple Java Bean style class with setters and getters. —-

Assignment: Predict the Output

Please take a few moments to predict the output before moving on.


Comments

" Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.