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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:47:38+00:00 2026-05-30T12:47:38+00:00

Hi there i am working on LinkedList project with Java and i have some

  • 0

Hi there i am working on LinkedList project with Java and i have some unclear issues in my mind. for example this is my “Patient” class;

public class Patient {

private int id;
private String name;
private String lastName;
private String doctor;

private Patient next;
private Patient prev;

public Patient(int id, String name, String lastName, String doctor, Patient next, Patient prev){

    this.id = id;
    this.name = name;
    this.lastName = lastName;
    this.doctor = doctor;
    this.next = next;
    this.prev = prev;

}

and when i construct my LinkedList i create a header and tail node like this.

private Patient header = new Patient(0, null, null, null, null, null);
private Patient tail = new Patient(0, null, null ,null ,null, null);

but if i create these two nodes without new Patient(0, null, null, null, null, null); anything doesnt change. could you please explain why_?

  • 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-30T12:47:39+00:00Added an answer on May 30, 2026 at 12:47 pm

    You get null references when not using the new keyword. Have you tried to access and do something with Objects that aren’t instanced with the new key word?
    Add a method called getName() and call it on a Patient variable before it is instanced. This will result in an “null pointer exception”

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

Sidebar

Related Questions

How can I have PHP display this URL correctly? Is there a working encoding
I need some help making this program for class. We are working with g++
There are some very useful classes for working with images. I am stuck with
Let's say I have a class A and this class has a List l
Is there a working example out there that demonstrates how to append additional rows
Does anyone know if there's working example of the tabs with the validation plugin?
I am working on an application which has some legacy code. Here, there is
I was assuming LinkedList.Clear() was O(1) on a project I'm working on, as I
I'd have a question here considering java generics. I have a generic class called
I am working on a project and i have tested it on nexus one.

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.