Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 814565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:32:30+00:00 2026-05-15T01:32:30+00:00

Helo, there are 3 files, CustomerClient.java , CustomerServer.java and Customer.java PROBLEM: In the CustomerServer.java

  • 0

Helo, there are 3 files, CustomerClient.java, CustomerServer.java and Customer.java


PROBLEM: In the CustomerServer.java file, i get an error when I compile the CustomerServer.java at line : System.out.println(a[k].getName());


ERROR:


init:

deps-jar:

Compiling 1 source file to C:\Documents and Settings\TLNA\My Documents\NetBeansProjects\Server\build\classes

C:\Documents and Settings\TLNA\My Documents\NetBeansProjects\Server\src\CustomerServer.java:44: cannot find symbol

symbol  : method getName()

location: class Customer

                        System.out.println(a[k].getName());
1 error
BUILD FAILED (total time: 0 seconds)


CustomerClient.java


import java.io.*;

import java.net.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.border.*;


public class CustomerClient extends JApplet {

private JTextField jtfName = new JTextField(32);
private JTextField jtfSeatNo = new JTextField(32);
// Button for sending a student to the server
private JButton jbtRegister = new JButton("Register to the Server");
// Indicate if it runs as application
private boolean isStandAlone = false;
// Host name or ip
String host = "localhost";

public void init() {


    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(2, 1));
    p1.add(new JLabel("Name"));
    p1.add(jtfName);
    p1.add(new JLabel("Seat No."));
    p1.add(jtfSeatNo);

    add(p1, BorderLayout.CENTER);
    add(jbtRegister, BorderLayout.SOUTH);


    // Register listener
    jbtRegister.addActionListener(new ButtonListener());

    // Find the IP address of the Web server
    if (!isStandAlone) {
        host = getCodeBase().getHost();
    }
}

/** Handle button action */
private class ButtonListener implements ActionListener {

    public void actionPerformed(ActionEvent e) {
        try {
            // Establish connection with the server
            Socket socket = new Socket(host, 8000);

            // Create an output stream to the server
            ObjectOutputStream toServer =
                    new ObjectOutputStream(socket.getOutputStream());

            // Get text field
            String name = jtfName.getText().trim();
            String seatNo = jtfSeatNo.getText().trim();

            // Create a Student object and send to the server
            Customer s = new Customer(name, seatNo);
            toServer.writeObject(s);
        } catch (IOException ex) {
            System.err.println(ex);
        }
    }
}

/** Run the applet as an application */
public static void main(String[] args) {
    // Create a frame
    JFrame frame = new JFrame("Register Student Client");

    // Create an instance of the applet
    CustomerClient applet = new CustomerClient();
    applet.isStandAlone = true;

    // Get host
    if (args.length == 1) {
        applet.host = args[0];

    // Add the applet instance to the frame
    }
    frame.add(applet, BorderLayout.CENTER);

    // Invoke init() and start()
    applet.init();
    applet.start();

    // Display the frame
    frame.pack();
    frame.setVisible(true);
}
} 

CustomerServer.java


import java.io.*;
import java.net.*;

public class CustomerServer {

private String name;
private int i;
private ObjectOutputStream outputToFile;
private ObjectInputStream inputFromClient;

public static void main(String[] args) {
    new CustomerServer();

}

public CustomerServer() {
    Customer[] a = new Customer[30];
    try {
        // Create a server socket
        ServerSocket serverSocket = new ServerSocket(8000);
        System.out.println("Server started ");

        // Create an object ouput stream
        outputToFile = new ObjectOutputStream(
                new FileOutputStream("student.dat", true));

        while (true) {
            // Listen for a new connection request
            Socket socket = serverSocket.accept();

            // Create an input stream from the socket
            inputFromClient =
                    new ObjectInputStream(socket.getInputStream());

            // Read from input
            //Object object = inputFromClient.readObject();
            for (int k = 0; k <= 2; k++) {
                if (a[k] == null) {
                    a[k] = (Customer) inputFromClient.readObject();
                    // Write to the file
                    outputToFile.writeObject(a[k]);
                    //System.out.println("A new student object is stored");

                    System.out.println(a[k].getName());

                    break;
                }

                if (k == 2) {
                    //fully booked
                    outputToFile.writeObject("All seats are booked");
                    break;
                }
            }



        }
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
    } catch (IOException ex) {
        ex.printStackTrace();
    } finally {
        try {
            inputFromClient.close();
            outputToFile.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
}

Customer.java


public class Customer implements java.io.Serializable {

private String name;
private String seatno;

public Customer(String name, String seatno) {
    this.name = name;

    this.seatno = seatno;
}

public String getName() {
    return name;
}

public String getSeatNo() {
    return seatno;
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:32:31+00:00Added an answer on May 15, 2026 at 1:32 am

    The build message says its only compiling one source file. Perhaps the Customer class changed to include the getName function and has not been recompiled since.

    Did you try compiling all three source files at the same time?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is covered in the book (http://book.cakephp.org/view/249/Custom-Query-Pagination) Bascially, you would… May 16, 2026 at 9:11 am
  • Editorial Team
    Editorial Team added an answer class MySimpleStructure attr_accessor :data1, :data2, :m1 end s1 = MySimpleStructure.new… May 16, 2026 at 9:11 am
  • Editorial Team
    Editorial Team added an answer The reason why is that the Monitor methods all take… May 16, 2026 at 9:11 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Helo! I create in my project a folder named 'Templates'. In this folder I
Helo, My question is I have one Stored Procedure in SQL Server that returns
Helo, I am pretty new to Ruby (using 1.8.6) and need to know whether
Helo guys, I am working wid CStringArray and i want to know how to
I'm trying to write a program that manipulates unicode strings read in from a
I am trying to use Regex in C# to look for a list of
I have a SMTP server that only accepts a predefined From sender. However, I
I am trying to use gmail's SMTP server smtp.gmail.com to send mails using C
I have this program in c++: #include <iostream> using namespace std; int main() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.