• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to write constructor?  RSS feed

 
chanti kareti
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

array[0] = new MyClass();
array[1] = new MyClass(array[0]);

How can i write a constructor in MyClass, for above code. I required all the data in array[0] is have to copy in array[1].
 
Mohamed Sanaulla
Bartender
Posts: 3179
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JR,

please TellTheDetails PostRealCode so that we can help you out. Also you can search for java tutorials on the basics on OOP in Java
 
Abubacker Siddik
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to create something like this??

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!