How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Raj Your Own Question

Raj, Engineer
Category: Homework
Satisfied Customers: 1282
Experience:  4 + Experiance in IT Industry
Type Your Homework Question Here...
Raj is online now
A new question is answered every 9 seconds

In a language such as C++ with pointers you can construct a

This answer was rated:

In a language such as C++ with pointers you can construct a linked list, or chain, where you have a class that can act as a node or a link, and that class includes a pointer to that same type of class, so that from a declared object of that class you can allocate dynamically another object of that class through that pointer, and from the new object you can allocate another new object from the poiner of that latter object, etc. But then, and this is important, with the list fully formed you can delete a link by taking the pointer of one object in the chain and repointing it to a different object, like a link further down the chain. By similarly repointing pointers, you can also insert new links into the chain between two existing links, or even create a circular linked list by pointing the pointer of a latter link to an object that preceeded it in the chain, or a doubly linked list by the class having two such pointers, one to point to its succesor and the other one to point to its predecesor. I need to be able to do this in Java, which doesn't have pointers. How can I do this in Java?
Hi there,

I will be helping you with the solution.
You need the concept of how to use it in java or do you need a code to demonstrate how it can be achieved in java?

Thank you
Customer: replied 3 years ago.

What I need is how I can do what I described in Java, particularly the insertion of new links (between links) or deletion (from between links) of links no longer wanted. The critical thing is that in C++ (or Ada or Pascal, or any other language with pointers), I can assign a pointer to point to a pre existing object

In Java we can achieve the requirement by creating a node class which will have two objects of type node(itself data type)
These node is now like a pointer with one value variable and the two objects of node type with name left andrights which will be acting as pointers.
Initialize left and right to null and put the mutator and accessor methods for all three bariables.

Now you can use the node as pointer in your main code and change the pointing property using the accessor and mutator methods.

Got the concept?

If my answer was helpfull than dont forget to RATE MY ANSWER.
Customer: replied 3 years ago.

the node class must be a new Java feature. I only have books that cover older versions of Java, so I don't know how to use the node class, or anything about it. Can you please show me how to use it? Can you please show me an example of its use to insert a new link between two preexiting consecutive links in a linked chain?

Actually node class is not an inbuilt feature in java it will be a customized class created by us to act as a linked list.

I will provide you the sample code to demonstrate it in next few hrs.
Customer: replied 3 years ago.

If you have to create a customized class yourself, then that class must contain objects that act as pointers (the objects of node type), and you must be able to assign these to point to preexisting nodes, but Java does not have pointers.

Will post you a sample code in next 2 - r hrs.
Yes Java does not have pointers but you can customize the classes in a way that it can be used with functionality as a pointer.

Do you want me to work on the code to demonstrate that??
Customer: replied 3 years ago.

yes, please provide me with some example of code that demonstrates that.

The reason I chose insertion of a link into a chain, between preexisting links, is that it forces you to declare a new link dynamically ("on the heap") and also to repoint pointers, that pointed to given links, to point to other links instead, preexisting links.

What software do you use to run JAVA Code. Is it Netbean, Eclipse or any other?
Customer: replied 3 years ago.

I use Java version 1.6.0 I compile the code and link and execute it using its commands. I use a microsoft windows XP based personal computer. I have never heard of "Netbean" or "Eclipse". But just show me the code that you think will work, in a text file

Ok No Problem I will provide you the JAVA Code file.

Give me 30 min and I will provide you the code.

You need to spend $3 to view this post. Add Funds to your account and buy credits.
Raj, Engineer
Category: Homework
Satisfied Customers: 1282
Experience: 4 + Experiance in IT Industry
Raj and 2 other Homework Specialists are ready to help you
Customer: replied 3 years ago.

oh, I think I understand. Any object variable automatically acts as a pointer, and you can either dynamically allocate a new value for that object pointer or assign it to another object, a preexisting object, of the same type. It finally "clicked" in my head.

Yes, Thats what I was trying to explain you.
Since using the functions mutator and accessor we can change its value any time so we can create the functioning of pointers for linked list using this concept even when there is no Pointer support in JAVA.

Thank you for your Feedback

In Future to request any new Question to me just begin your Question with TO RAJ followed by the Question in the following format:

TO RAJ: Followed by the Question.

Have a Good Day.
Customer: replied 3 years ago.

I have a new question (new fee?) to ask you about Java, something else that I have done with C++ and would like to know how to do it with Java. This one involves the RandomAccessFile class, how to use it to input and output BigDecimal objects

Yes i can help you but you will have to post a new question for that and fee will depend on the effort so post a new question beginning with TO RAJ followed by the question.

Thank you

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
< Previous | Next >
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
  • He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX

Meet The Experts:

  • LogicPro



    Satisfied Customers:

    Expert in Java C++ C C# VB Javascript Design SQL HTML
< Last | Next >
  • LogicPro's Avatar



    Satisfied Customers:

    Expert in Java C++ C C# VB Javascript Design SQL HTML
  • Manal Elkhoshkhany's Avatar

    Manal Elkhoshkhany


    Satisfied Customers:

    More than 5000 online tutoring sessions.
  • Linda_us's Avatar


    Finance, Accounts & Homework Tutor

    Satisfied Customers:

    Post Graduate Diploma in Management (MBA)
  • Chris M.'s Avatar

    Chris M.

    M.S.W. Social Work

    Satisfied Customers:

    Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)
  • F. Naz's Avatar

    F. Naz

    Chartered Accountant

    Satisfied Customers:

    Experience with chartered accountancy
  • Bizhelp's Avatar



    Satisfied Customers:

    Bachelors Degree and CPA with Accounting work experience
  • Seanna's Avatar



    Satisfied Customers:

    3,000+ satisfied customers, all topics, A+ work

Related Homework Questions