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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:53:56+00:00 2026-06-13T07:53:56+00:00

I need to be able to print out the Student objects(all variables) in my

  • 0

I need to be able to print out the Student objects(all variables) in my array list. Is this possible? When i try to print it outputs this sort of thing e.g student.Student@82701e. I think it’s hexadecimal or something

This is my code:

package student;

public class Student {

    private String studentName;
    private String studentNo;
    private String email;
    private int year;


    public Student() {
        this.studentName = null;
        this.studentNo = null;
        this.email = null;
        this.year = -1;
    }

    public Student(String nName, String nNum, String nEmail, int nYr) {
        this.studentName = nName;
        this.studentNo = nNum;
        this.email = nEmail;
        this.year = nYr;
    }

    public void setStudentName(String newStudentName) {
        this.studentName = newStudentName;
    }

    public void setStudentNo(String newStudentNo) {
        this.studentNo = newStudentNo;
    }

    public void setEmail(String newEmail) {
        this.email = newEmail;
    }

    public void setYear(int newYear) {
        this.year = newYear;
    }

    public String getStudentName() {
        return studentName;
    }

    public String getStudentNo() {
        return studentNo;
    }

    public String getEmail() {
        return email;
    }

    public int getYear() {
        return year;
    }
}

package student;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class studentTest {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);



        List<Student> Students = new ArrayList();


        Student student1 = new Student();

        student1.setStudentName("Bob Marley");
        student1.setStudentNo("N0002");
        student1.setEmail("student2@student.com");
        student1.setYear(2);

        Students.add(student1);

        Student student2 = new Student();

        student2.setStudentName("Bill Harvey");
        student2.setStudentNo("N0003");
        student2.setEmail("student3@student.com");
        student2.setYear(2);

        Students.add(student2);

        Student student3 = new Student();

        student3.setStudentName("John Beans");
        student3.setStudentNo("N0004");
        student3.setEmail("student4@student.com");
        student3.setYear(2);

        Students.add(student3);


        System.out.println("Add new students: ");
        System.out.println("Enter number of students to add: ");
        int countStudents = input.nextInt();

        for (int i = 0; i < countStudents; i++) {
            Student newStudents = new Student();


            System.out.println("Enter details for student: " + (i + 1));

            System.out.println("Enter name: ");
            newStudents.setStudentName(input.next());

            System.out.println("Enter Number: ");
            newStudents.setStudentNo(input.next());System.out.println("Search by student number: ");



            System.out.println("Enter email: ");
            newStudents.setEmail(input.next());

            System.out.println("Enter year: ");
            newStudents.setYear(input.nextInt());
            Students.add(newStudents);
        }


    }
}
  • 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-13T07:53:57+00:00Added an answer on June 13, 2026 at 7:53 am

    Override toString() method in Student class as below:

       @Override
       public String toString() {
            return ("StudentName:"+this.getStudentName()+
                        " Student No: "+ this.getStudentNo() +
                        " Email: "+ this.getEmail() +
                        " Year : " + this.getYear());
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a situation and it goes like this: I need to print out
I need to be able to print out the correct zipcodes that meet the
I need to be able to print reports, general stuff. But I need it
I need to be able to access a list throughout my Rails project. For
I need to be able to strip out a condition in a string, here
I need to be able to map out in coordinates real world cities and
I need to write a PHP script that will print out results from a
I have a timetable in memory, and need to be able to print it
I feel incredibly stupid for not being able to figure this out, but I
Can a Java Applet able to print out text/html easily to standard printer driver(s)

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.