Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In java I don't understand why didn't the return give a 500,000 value output as the first line since the code typed by my professor
In java I don't understand why didn't the return give a 500,000 value output as the first line since the code typed by my professor said return score * 1000? Instead it said 500 points?
Here's the code:
public static void main(String[] args) { int newScore = calculateScore ("Tim", 500); System.out.println("New Score is" + newScore); } public static int calculateScore(String playerName, int score) { System.out.println("Player" + playerName + "scored" + score + "points"); return score * 1000; }
Here's the output:
// Line 1
Player Tim scored 500 points
// Line 2
New score is 500000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started