• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

array objects?

 
Brad Dwan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wondering if is at all possible to 'store' an object within an array?


At work (hence can't test it) and was just thinking about it, thought this would be a good question to ask people with a bit more experience.
 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can store objects in an array
 
Brad Dwan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pramod P Deore wrote:Yes you can store objects in an array


Appreciate it
 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In class Test array t is created which store 3 objects.
 
Brad Dwan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pramod P Deore wrote:In class Test array t is created which store 3 objects.


Very nice, thank you for your help.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
welcome to javaranch
 
Brad Dwan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seetharaman Venkatasamy wrote:welcome to javaranch


cheers mate Studying Bachelors of Computing and the first two years are based on Java, then a year of C++. Kind of strange really, would've thought that C++ would be more dominant. I've done a lot of PHP in my time so OOP and procedural programming, although I'm not used to such a 'strict' language, so it's a nice change
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arrays unlike Collections can store anything which means: Objects and primitives .
The only problem which I see with arrays is the compulsion of knowing the size before when creating its Object but on the other hand Collections gives us a lot flexibility .
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brad Dwan wrote:would've thought that C++ would be more dominant.

Why? It hasn't been, for some time now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic