User Tools

Site Tools


basics:ex7

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
basics:ex7 [2007/02/25 16:54]
bdefrain create
basics:ex7 [2021/02/05 13:49] (current)
Line 1: Line 1:
 +[[basics:intro|Intro]]
 +[[basics:ex1|Ex1]]
 +[[basics:ex2|Ex2]]
 +[[basics:ex3|Ex3]]
 +[[basics:ex4|Ex4]]
 +[[basics:ex5|Ex5]]
 +[[basics:ex6|Ex6]]
 +[[basics:ex7|Ex7]]
 ====== The Basics: Exercise 7 ====== ====== The Basics: Exercise 7 ======
  
Line 25: Line 33:
 <code aspectj> <code aspectj>
 public class ApplicationTest { public class ApplicationTest {
-  public static void output(Application t) {+  public static void main(String[] arg) { 
 +    Application t = new Application()
 +    t.name = "YourApplication";
     for(String s: t)     for(String s: t)
       System.out.println(s);       System.out.println(s);
-  } 
- 
-  public static void main(String[] arg) { 
-    Application t1 = new Application(); 
-    Application t2 = new Application(); 
-    t2.name = "YourApplication"; 
-    output(t1); 
-    output(t2); 
   }   }
 } }
 </code> </code>
 +
 +To start this new ''main'' method, right-click on the class ''ApplicationTest'' and select **Run As** -> **Java/AspectJ Application**.
 +
 +<note important>
 +Beside the expected output, you might see output from your previous advices when you run the code from class ''ApplicationTest''. Review your previous code and try to understand why they also apply to the new behavior.
 +</note>
 +
 +----
 +
 +Continue with the [[invariant:intro|Invariants]] track.
basics/ex7.1172418898.txt.gz · Last modified: 2007/02/25 16:54 by bdefrain