You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Code.java 670B

1234567891011121314151617181920212223242526272829303132333435363738
  1. class Child extends Parent{
  2. public String mParent = "John";
  3. public Child(String parent) {
  4. this.mParent = parent;
  5. }
  6. public String getParent()
  7. {
  8. return this.mParent;
  9. }
  10. }
  11. class Parent {
  12. private String mName = "John";
  13. private int mAge = 50;
  14. public int getAge(){
  15. return mAge;
  16. }
  17. }
  18. aspect MyTest {
  19. public Child.new(String parent, int age) {
  20. this(parent);
  21. System.out.println("Get Age:" + super.getAge());
  22. System.out.println("Child Name:" + this.mParent);
  23. }
  24. }
  25. public class Code {
  26. public static void main(String []argv) {
  27. new Child("Andy",5);
  28. }
  29. }