what is use of new and this keyword in java
gabhinav31
0
Newbie Poster
Recommended Answers
Jump to PostVirtualAsset's defintions are correct. Examples might help, though:
"This" would often be used in a constructor or in a setter method. You'll often see it used like this:
public class MyClass{ String someField; public MyClass(String someField) { this.someField = someField; } public void setSomeField(String somefield) { …
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.