Skip to content

Tag: methods

Calling a Method in a running Thread Object [closed]

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 5 months ago. Improve this question I’m a Java beginner. I want to call a Method in a running Java Thread Object. It always throws this

Returning a value from one method to another to be used in the output

I can’t figure out how to return the value of finalCost to the main method and have it printed. Specifically, I can’t find how to use the returned value in the “println” line. Answer You call calcMonthlyCharge(downloadLimit),but don’t store the returnvalue. When you call System.out.println(“Plan monthly cost: ” + calcMonthlyCharge(finalCost) ); It is unknown what finalcost is, this is a