Consider the following class declaration: 1 public class Map 2 { 3 private String city = "Seattle"; 4 5 public void printCityName(String city) 6 { 7 System.out.println("The name of the city is " + city); 8 } 9 } What will be printed if we invoke printCityName("Boston")? Justify your answer

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter10: Object-oriented Programming
Section: Chapter Questions
Problem 16RQ
icon
Related questions
Question

Consider the following class declaration:

1 public class Map

2 {

3 private String city = "Seattle";

4

5 public void printCityName(String city)

6 {

7 System.out.println("The name of the city is " + city);

8 }

9 }

What will be printed if we invoke printCityName("Boston")? Justify your answer.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT