• Post Reply Bookmark Topic Watch Topic
  • New Topic

creating object  RSS feed

 
saurabh pandey
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in how many wayes we can create an object in java?
 
Rajah Nagur
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Using new operator
2. Cloning
3. Reflection
4. Class.newInstance()
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

I always wonder where this question comes from ... a school assignment? We usually try not to give complete answers for school work. It's more fun if you have to dig for them a bit.

Read up on ObjectInputStream. Does that create objects or not?

Read up on Class.newInstance() and reflection. Are they two things or the same?

Let us know what you think!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!