Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualalnite

Posted 16 December 2012 - 01:59 PM

Exams are a bitch, as it requires you to read your professor's mind.

Create a fillList() method that takes a reference variable of type Ticket as a parameter


void fillList(Ticket ticket) {
   // insert ticket to your list
}

In Java, everything is passed by references except primitives (int, bool, long, float, double).

how would i go about passing an object of an inner class as a paramitar to a method in the outer class?


You can invoke a method in the outer class from the inner class.

class OuterClass {
	public void someMethod(InnerClass ic) {
	}

	class InnerClass {
		public void doStuff() {
			someMethod(this);  // OK
		}
	}
}

#1alnite

Posted 16 December 2012 - 01:58 PM

Exams are a bitch, as it requires you to read your professor's mind.

Create a fillList() method that takes a reference variable of type Ticket as a parameter


void fillList(Ticket ticket) {
   // insert ticket to your list
}

In Java, everything is passed by references except primitives (int, bool, long, float, double).

how would i go about passing an object of an inner class as a paramitar to a method in the outer class?


You can invoke a method in the outer class from the inner class.

class OuterClass {
    public void someMethod() {
    }

    class InnerClass {
	    public void doStuff() {
		    someMethod();  // OK
	    }
    }
}

PARTNERS