Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to assign a Parameter to a Data Member?
How to assign a Parameter to a Data Member? [message #1724436] Tue, 23 February 2016 22:55 Go to next message
donald reggie is currently offline donald reggieFriend
Messages: 2
Registered: February 2016
Junior Member
In one of my eclipse classes I have a parameter that is a string with the variable thing name
public Turtle(int size, double x, double y, String name)

I have "name" set as a data member
private String name;

I assigned name parameter to the name data member like this:
name = this.name;

Is there something wrong with this code?
For what I'm doing it is not working correctly and giving me a "null" in the console for the said names of the turtles (I set the turtle names in my gui class)
Re: How to assign a Parameter to a Data Member? [message #1724437 is a reply to message #1724436] Tue, 23 February 2016 23:12 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4440
Registered: July 2009
Senior Member

These forums are for questions specific to using Eclipse, not general programming help. That said, your assignment statement is doing the reverse of what you're intending--you have the left and right sides opposite of what is needed.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: How to assign a Parameter to a Data Member? [message #1724438 is a reply to message #1724437] Tue, 23 February 2016 23:31 Go to previous messageGo to next message
donald reggie is currently offline donald reggieFriend
Messages: 2
Registered: February 2016
Junior Member
Thank you so much!

Where should I post questions like these in the future?
Re: How to assign a Parameter to a Data Member? [message #1724439 is a reply to message #1724438] Tue, 23 February 2016 23:34 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4440
Registered: July 2009
Senior Member

The forums at JavaRanch (http://www.coderanch.com/forums/c/1/java) and Stack Overflow seem more suited to it.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Facing problem while debugging
Next Topic:Format of "Creation Time" column in "Bookmarks" view.
Goto Forum:
  


Current Time: Tue May 07 13:35:57 GMT 2024

Powered by FUDForum. Page generated in 0.08185 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top