Results 1 to 3 of 3
Thread: Class as a Parameter.
- 05-12-2011, 04:38 PM #1Member
- Join Date
- May 2011
- Rep Power
Class as a Parameter.
I have an ArrayList of the Interface GamePiece. I want to make a method that takes that ArrayList and returns all the object of a certain type. For example I could have the method return all of the GameBall objects (which implement GamePiece) in the ArrayList of GamePiece interfaces. I know how to use instanceof to check if an object is a certain class, but how would I have the method take a type of class as a parameter? :confused:
- 05-12-2011, 04:44 PM #2
- 05-12-2011, 06:36 PM #3
- By Onra in forum New To JavaReplies: 4Last Post: 03-14-2011, 01:12 AM
- By ianyappy in forum New To JavaReplies: 8Last Post: 12-02-2010, 08:06 PM
- By xdzgor in forum JDBCReplies: 4Last Post: 11-19-2010, 09:03 AM
- By bazong in forum Advanced JavaReplies: 4Last Post: 06-18-2010, 10:08 AM
- By bukake in forum New To JavaReplies: 10Last Post: 09-06-2008, 09:26 PM