Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: passing refeerence of class

  1. #1
    Join Date
    Jun 2011
    My Mood
    Thanked 0 Times in 0 Posts

    Default passing refeerence of class

    hi ,

    i have a class by the name Node which is linked to class Interest ,Data,Timer.

    Node _____*Interest______0..1 Data_______Timer

    in timer class i start a thread ,after thread expires ,i want to set a flag in node class...how can i pass the reference for the specific node object to the timer class so that it sets the flag of specific node.
    should i pass the reference in the constructors of Interest,Data classes ,what would be the referenc for that

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 833 Times in 772 Posts
    Blog Entries

    Default Re: passing refeerence of class

    What did you try? It seems from your description you have a few ideas eg pass the reference to the constructor and hold onto said reference in a variable.

  3. #3

    Default Re: passing refeerence of class

    You must pass the reference to Node through the main class that runs your program. Interest must accept Node as a parameter and give it to Data, which then feeds it to Timer.
    Kenneth Walter
    Software Developer

Similar Threads

  1. HELP. Passing Array to class.
    By videodrome in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 13th, 2010, 04:35 AM
  2. Passing a value to another class
    By Semple in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 4th, 2010, 05:49 PM
  3. [SOLVED] Class not passing information
    By DiPep in forum What's Wrong With My Code?
    Replies: 6
    Last Post: July 26th, 2010, 10:04 AM
  4. Replies: 0
    Last Post: April 11th, 2010, 08:56 AM
  5. [SOLVED] Passing arrayList inside class
    By KrisTheSavage in forum Collections and Generics
    Replies: 1
    Last Post: March 27th, 2010, 12:45 PM