Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Explain the process of MBO

Answered: 1 week ago

Question

b. What groups were most represented? Why do you think this is so?

Answered: 1 week ago