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

  • SEARCH
  • Home
  • 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 9149923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:32:37+00:00 2026-06-17T11:32:37+00:00

I have a Java Class like this: public class Employee { String Name; int

  • 0

I have a Java Class like this:

public class Employee {
  String Name;
  int Id;
  int Age;

  void setName(String tempVal) {
    Name = tempVal;
    System.out.println(Name);
    System.out.println("\n");
  }

  void setId(int parseInt) {
    Id = parseInt;
    System.out.println(Id);
    System.out.println("\n");
  }

  void setAge(int parseInt) {
    Age = parseInt;
    System.out.println(Age);
    System.out.println("\n");
  }

}

Now I want to parse a employees.xml file using SAXParser using the code in the link: http://totheriver.com/learn/xml/xmltutorial.html#5.2

The problem is when I am adding the tempEmp to the list and accessing the list to print its value in printData() method, the output is something like:

No of Employees '3'.

Employee@140de537

Employee@1c43882a

Employee@15a08be5

Now, how do I extract the name, age and id of the employee individually?

  • 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-06-17T11:32:37+00:00Added an answer on June 17, 2026 at 11:32 am

    I guess you are adding the Employee object to the list and printing the objects directly from list.If you dont override the toString() method, it will call the toString() method of Object class(superclass of all class), which will be returing the classname@hashcode(hashcode of object).If you want to print some data from your class, you need to override toString() method in your class and return the format you require.

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

Sidebar

Related Questions

I have a Java class like this: public class Foo { public static int
Suppose I have a simple Java class like this: public class User { String
i have a java class like this public class A { private String field1;
I have a Java class that looks like this: public class My_ABC { int
I have a Java-Gnome GUI that is initialised like this: public static void main(String[]
I have some java classes like, Class User { String email; String name; String
In java, I have a class like this: public class MyClass extends Properties {
Lets say I have a class like this in Java: public class Function {
I have a class like this public SomeClass { private List<string> _strings = new
I have a final class, something like this: public final class RainOnTrees{ public void

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.