Results 1 to 3 of 3
  1. #1
    Qwertyness_ is offline Member
    Join Date
    Mar 2013
    Location
    Hermon, Maine USA
    Posts
    7
    Rep Power
    0

    Default Forcing a value to a method?

    I was wondering if there is a way to force a value on a method without a refference in the changed method.

    For example:

    Java Code:
    public static void SlotPlay50l8() {
        int bet = 400;
        	SlotInter();
        	
    }
        
    public static void SlotInter(int bet1) {
        	int bet1;
    }
    I want to make the value of bet1 the same as bet. However, I do not want to reference the method SlotPlay50l8 anywhere in the method SlotPlayInter because there are many
    more methods that will be like SlotPlay50l8. I want to be able to force the bet value into bet1 with the SlotPlay50l8 method but without referencing the method in the proccess. Is this possible? How would I go about doing this?
    Last edited by Qwertyness_; 03-06-2013 at 12:47 AM.

  2. #2
    Ronin is offline Senior Member
    Join Date
    Oct 2010
    Posts
    317
    Rep Power
    4

    Default Re: Forcing a value to a method?

    Hi Qwertyness, welcome to the forums.

    If I'm reading your request correctly, the short answer is yes. Your code in the example is more or less spot on with just a couple of chages required.
    Change the code on line three to the following:
    Java Code:
    SlotInter(bet);
    And ditch the declaration on line 8. As the variable has been declared in the signature of the method there is no need to redeclare it.

    Make these two changes and method SlotInter() will hold the value of 400 in the variable bet1.

    Regards.

  3. #3
    Qwertyness_ is offline Member
    Join Date
    Mar 2013
    Location
    Hermon, Maine USA
    Posts
    7
    Rep Power
    0

    Default Re: Forcing a value to a method?

    Thanks a million Ronin!
    It works now.

Similar Threads

  1. forcing scrollpane to autoscroll
    By yemista in forum AWT / Swing
    Replies: 6
    Last Post: 05-26-2012, 07:59 PM
  2. GridBagLayout - forcing all components to stay on top
    By Serpenthelm in forum AWT / Swing
    Replies: 3
    Last Post: 01-05-2012, 06:52 PM
  3. forcing a thread to run
    By yemista in forum Threads and Synchronization
    Replies: 6
    Last Post: 11-03-2011, 06:12 PM
  4. Forcing the mouse to stay quiet
    By ProspectiveDeveloper in forum AWT / Swing
    Replies: 4
    Last Post: 05-02-2010, 11:17 PM
  5. Forcing a thread to stop
    By sukatoa in forum Threads and Synchronization
    Replies: 7
    Last Post: 07-17-2009, 06:41 AM

Tags for this Thread

Posting Permissions

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