I have a problem with a Code coach, the saveCustomerInfo. | Sololearn: Learn to code for FREE!
+ 1

I have a problem with a Code coach, the saveCustomerInfo.

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); String firstName = read.nextLine(); String secondName = read.nextLine(); int age = read.nextInt(); int roomNumber = read.nextInt(); Customer customer = new Customer(); Customer.firstName = firstName; Customer.secondName = secondName; Customer.age = age; Customer.roomNumber = roomNumber; customer.saveCustomerInfo(); } } class Customer { String firstName; String secondName; int age; int roomNumber; public void saveCustomerInfo() { System.out.println("First name: " + firstName); System.out.println("Second name: " + secondName); System.out.println("Age: " + age); System.out.println("Room number: " + roomNumber); } } It doesn t work,the compilers says error and i dont know what to do and i can t skip this code coach Help

13th Aug 2022, 2:58 PM
Sebastian Valentin Cimpeanu
1 Answer
+ 3
Your object name is customer; (small c) But using class name Customer (capital C) for variable assignments...
13th Aug 2022, 3:05 PM
Jayakrishna 🇮🇳