Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. This post was edited and submitted for review 1 year ago and failed to reopen the post: Original close reason(s) were not resolved
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 needs to be used: my current
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 statement after it prints to the
Java Exercise: I’m not sure what I’m doing wrong and all help is appreciated
I am working with the following pieces of code and I keep getting this error message: Error: Main method not found in class Team, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application. All suggestions, opinions, and changes are welcome as I am completely lost on why this isn’t working.
Trying to understanding Exit, Loop, Method and If and Else [JAVA]
Hello guys I need help with my code. I am trying to understand how to use the method, loop,if-else statement, and exit code. So I’m writing a simple calculation base on the user choice but right now I can’t figure out how to make the input read to loop back when user input else than the number (mean no alphabet
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 they
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
Java Evaluating RPN using Shunting Yard Algorithm
I have the shunting yard algorithm that I found online: import java.util.HashMap; import java.util.Map; import java.util.Stack; public class ShuntingYardAlgorithm { private enum Operator { ADD(…
How to assign values to Attributes by passing argument using from method?
I need to assign YEAR, MONTH, DAY attributes to values just only using one set method. therefore I pass DATE.YEAR, DATE.MONTH, DATE.DATE as an argument also with values by calling set method line by line. You can make changes anything to the set method. But You cannot make changes to the main method. Answer Mark YEAR, MONTH AND DAY as
Can I use a randomly generated number as a parameter to a method in Java?
So I’m very new to Java so this question might have a pretty simple answer. I’m trying to create a Magic8 ball program and I want the fortune to depend on the randomly generated number, but it’s …