Results 1 to 4 of 4
- 08-23-2010, 07:39 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 11
- Rep Power
- 0
Method, returning reference to an object
Hello,
I want to call a method and gain reference to proper object. Next I wan't to use this reference to running other methods.
Java Code:Kasa [B]myobject;[/B] Kasa [B]myobject2;[/B] public void run(){ wybierz(); [B]result[/B].dodaj(this, priorytet); //reference from wybierz(); } public Kasa wybierz() { if(1 == 2){ result = [U]myobject;[/U] //REFERENCE TO OBJECT }else { Kasa myobject2; result = [U]myobject2;[/U] } return [B]result;[/B] // myobject or myobject2; }Last edited by Saletra; 08-23-2010 at 07:42 PM.
- 08-23-2010, 08:02 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
Like this?
kind regards,Java Code:Kasa result= wybierz(); result.dodaj( ... );
Jos
- 08-23-2010, 08:16 PM #3
Member
- Join Date
- Jul 2010
- Posts
- 11
- Rep Power
- 0
I hope, this is it:)
Thanks.
- 08-23-2010, 08:22 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
returning an object from a method
By bigj in forum New To JavaReplies: 7Last Post: 01-08-2010, 12:39 PM -
Object and reference
By katie in forum New To JavaReplies: 2Last Post: 10-19-2009, 03:45 PM -
Very new to Java, how to reference an object
By tornado in forum New To JavaReplies: 3Last Post: 12-05-2008, 12:51 AM -
Object reference to number
By dayneo in forum New To JavaReplies: 4Last Post: 05-27-2008, 01:23 PM -
Getting the Object Reference Name
By Deathmonger in forum New To JavaReplies: 2Last Post: 03-12-2008, 02:51 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks