• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need explanation on Object[]  RSS feed

 
Kay Lee
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello..

can anyone explain what is, Object[]?

example:

Object[] result;

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's an array that holds references of type "Object" (which is short for "java.lang.Object").
 
Kay Lee
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so it's a type of array.
how do I initialize this array type?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you create an array of Strings like this:

and you create an array of Integers like this:

How do YOU think you would create an array of Objects?
 
Kay Lee
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it something like
?

 
Kay Lee
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do I put data into Object[] ? can show me some example?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start here: http://docs.oracle.com/javase/tutorial/java/index.html. The chapter on "Language Basics" has a section on arrays.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!