What is the output of the following code? public class Employee { public String name; public int salary; public Employee(String empName, int empSalary) { name = empName; salary = empSalary; } public void printEmployeeInfo() { System.out.println("Name: " + name); System.out.println("Salary: $" + salary); } public void giveRaise(int raiseAmount) { salary += raiseAmount; } public static void main(String[] args) { Employee emp = new Employee("John", 50000); emp.printEmployeeInfo(); emp.giveRaise(2000); emp.printEmployeeInfo(); } }




© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.