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 9085577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:16:43+00:00 2026-06-16T21:16:43+00:00

i have problem with printing the array after reading it. After printing, the address

  • 0

i have problem with printing the array after reading it. After printing, the address of memory is printed, not value of the array. What can i do for that ?

public class MyClass
{
     Student St = new Student();

     Student[]Array1 = new Student[10];


     void AddList()
     {

            Scanner Scan = new Scanner(System.in);

            for (int i=0; i<Array1.length & i<ArrayF1.length; i++)
            {
                System.out.println("Enter Student NAME Number " + (i+1) + ":");
                Array1[i] = new Student();
                Array1[i].setName(Scan.next());


                //System.out.println("Enter Student MARK Number " + (i+1) + ":");
                //St.setMark(Scan.nextFloat());
            }

    }

this is my print method. The result of print is like this

(studentproject.Student@1a758cb)

 void PrintList()
 {

            for (int i=0; i<Array1.length; i++)
            {

                System.out.println(Array1[i]);

            }
 }

this is my Student Class that i have all my setter and getter method on that … So i have 3 Class how can i work with this 3 class and in one of them get the data and in another print the Mark data and in third class print the Student Name data … how can i do that … i do some code but i dont know is it correct or not … thanks for your help …

public class Student
{
private String Name;
private float Mark;

/**
 * @return the Name
 */
public String getName() {
    return Name;
}

/**
 * @param Name the Name to set
 */
public void setName(String Name) {
    this.Name = Name;
}

/**
 * @return the Mark
 */
public float getMark() {
    return Mark;
}

/**
 * @param Mark the Mark to set
 */
public void setMark(float Mark) {
    this.Mark = Mark;
}

}
  • 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-16T21:16:44+00:00Added an answer on June 16, 2026 at 9:16 pm

    Just override the toString() method in Student class, and return the appropriate string you want to get printed when you print an instance.

    It may look like: –

    @Override
    public String toString() {
        return "Name: " + studentName;
    }
    

    Currently, the default implementation of toString() method of Object class is invoked, and what you are seeing is the format returned from that method, which is of the form – Type@hashCode

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

Sidebar

Related Questions

I have a very strange problem with #any? printing true for an array that
I have a small memory access problem in my program and I do not
My problem is: I have an array called $ownerArray that another array need to
As you can tell by the script below, I have a problem, I'm not
I have problem with repopulating form_upload after validation. Other input fields or selectboxes are
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have problem with context menu. I have got: @Override public void onCreateContextMenu(ContextMenu menu,
This is a follow up question from Problem with array assignment I now have
I have a 2D-array that I want to sort based on the second column.
EDIT: I have found the error: I did not initialize an array with a

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.