Skip to content

Tag: methods

How do i pass variables into methods – java [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I need to use a variable from one method in another. Here is the code: Here is where it need…

Find all matching elements in Array – Java

At the moment my code is only giving me the first matching result. The user inputs their desired room price and at the moment it will only display the first match. In the case the user inputs ’60’ to the console it should display 3 results. I imagine i’ll need another forloop and if statemen…

Java class and methods returning wrong value

I am writing code in java to simulate entering a circus at a very low level code wise. It is just a couple of classes under a main class, Customer. My code is just the main class and its methods, then some print statements, My admitted method is returning false for all values when it should return true if the…

Storing methods identifiably in Java

I’m trying to come up with a solution to a problem where I want to store method references in some way so that I can invoke them when needed and remove them when I don’t need them on my list of methods. The underlying goal here goes something like this: I have a Person class: I make 2 instances of