Array | object |
---|---|
It can only store one datatype variables | It can store multiple datatype variables |
It cannot execute methods | It can execute methods |
It can store multiple datatype variables
It can execute methods
Where did you get that from? The bit about one datatype variable sounds confused; please explain what you mean by it. If you mean that the fields of a non‑array object can have different types, then I shall say that they can only have the types declared when the code is written. Similarly an array has one type of element, which is defined when the code is written. The following code defines the type of element as Foo:-...but an array can be declared with any element type without <> in its name. An object with one field will have only one type of field.Hari Nagarjuna wrote:. . .
Array object It can only store one datatype variables It can only store multiple datatype variables It cannot execute methods It can execute methods
An array is what Tim has described here: an object from a class which only overrides one method from Object and doesn't declare any new methods.Tim Moores wrote:. . . . Objects need not have publicly (or even privately) executable methods.
Hari Nagarjuna wrote:
Array object It can only store one datatype variables It can only store multiple datatype variables It cannot execute methods It can execute methods
Liutauras Vilda wrote:
Hari Nagarjuna wrote:
Array object It can only store one datatype variables It can only store multiple datatype variables It cannot execute methods It can execute methods
If you had to choose from those 4 sentences and put them in the corresponding table columns/rows - it is fine, but in general I find it unnecessarily confusing as for descriptions.
When we say about object "It can only store multiple datatype variables", I end up being confused, so it cannot store singular datatype variables? It can't do anything else? Those questions don't require answer, but just shows, how I would be confused reading in a book about object presented in such way.
There are three kinds of actuaries: those who can count, and those who can't.
You appear not to have read my post, then. What good is it asking a question and then not reading the replies?Hari Nagarjuna wrote:. . . methods cannot be used with this array.--->maybe I am wrong.But at least I have not seen it from the topics I have read yet.
You are not assigning an int or a boolean to your object (and cannot). Only to its fields.. . . Above I have declared one as an object and I could assign int,boolean values to same object and I could call display() method using the object which is not possible using arrays. . . .
No object calls methods. Only statements and expressions can call methods. As I showed you earlier, minus line 10 which won't compile, you can call methods on an array object.But considering array as an object it cannot even call methods? . . .
Attractive, successful people love this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|