Results 1 to 2 of 2
  1. #1
    -F7-ForLife's Avatar
    -F7-ForLife is offline Never Surrender
    Join Date
    May 2015
    Rep Power

    Default Passing values along from one object to another?

    I'm trying to develop a game where you have to guess a number. If the guess is correct, you earn points, which allows you to purchase chance modifiers and earn a higher score.

    I have objects for a main menu, the game itself, a currency checker, and the shop.

    The issue I'm running into is having objects recognize the amount of currency earned. I'm sure there is a simple remedy to this; however, what I have attempted is a public int class that stores values to be shared amongst other objects, but I can't tie it into my existing objects.

    Any suggestions on a solution to this?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Passing values along from one object to another?

    Can you post some sample code that shows what you are trying to do and the problem you are having?

    If an object of a class is holding values that you want code in another class to see, add a getter method to the class with the value and call it from the class that wants to see the value.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 9
    Last Post: 02-20-2015, 09:28 AM
  2. Passing a Statement Object into a Program Object
    By Adomini in forum New To Java
    Replies: 2
    Last Post: 02-23-2013, 03:57 PM
  3. passing object as value for checkbox values??
    By Pooja Deshpande in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-17-2009, 11:55 AM
  4. Passing the Values
    By Lagarto in forum JDBC
    Replies: 1
    Last Post: 07-16-2007, 03:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts