Results 1 to 6 of 6
- 02-12-2009, 10:57 PM #1
Member
- Join Date
- Feb 2009
- Posts
- 1
- Rep Power
- 0
Passing Class Reference to method
Hello People
Please suggest me the use of passing class reference in a method
Here is the sample code from class A
And, then when it is called inside class C, it is referred to as ,Java Code:public Integer[] getReport(Class classname, String sql) {
Java Code:new A().getReport(B.class, "select * from Table A")
Please give your suggestions on thiswhere B is another class
Thanks
Nek
- 02-13-2009, 06:05 AM #2
Member
- Join Date
- Oct 2008
- Posts
- 31
- Rep Power
- 0
This can be used to do runtime type identification. for example
you can do if class is B.class then do one thing and if class is C.class then do other,
this can also be used to use reflection based on class methods.Live life king size
[Lucene]
- 02-13-2009, 06:06 AM #3
Member
- Join Date
- Oct 2008
- Posts
- 31
- Rep Power
- 0
also check the java.lang.reflection API document for more details on reflection which is a very powerfull API
Live life king size
[Lucene]
- 02-14-2009, 06:50 AM #4
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
I may not be understanding the problem, but it seems to me you want to define and implement a common interface here rather than using reflection.
- 03-25-2009, 11:17 PM #5
Member
- Join Date
- Mar 2009
- Posts
- 25
- Rep Power
- 0
Please could you explain the target?
- 03-26-2009, 05:08 AM #6
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
Similar Threads
-
[SOLVED] passing array between main and method,vice-versa
By blueyan in forum New To JavaReplies: 5Last Post: 10-04-2008, 11:13 AM -
Calling a method in a different class from within a method problem
By CirKuT in forum New To JavaReplies: 29Last Post: 09-25-2008, 07:55 PM -
Problems passing a scan object to a method
By xkross in forum New To JavaReplies: 4Last Post: 04-16-2008, 03:56 PM -
is synchronization on method passing local variables as parameters needed
By reddzer in forum Java ServletReplies: 0Last Post: 11-10-2007, 04:47 PM -
Help passing arraylist to another class
By adlb1300 in forum New To JavaReplies: 3Last Post: 11-06-2007, 08:02 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks