Menu

Java Don T Understand Didn T Return Give 500 000 Value Output First Line Since Code Typed Q43819115

In java I don’t understand why didn’t the return give a 500,000value output as the first line since the code typed by my professorsaid 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

Expert Answer


Answer to 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 m…

OR