rgb192
asked on
multiple char primitive data type
char is primitive
string="hello";
char[6]='h','e'','l','l'l' ,'o'
is multiple char primitive or an object
could an object be primitive?
string="hello";
char[6]='h','e'','l','l'l'
is multiple char primitive or an object
could an object be primitive?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Agree with gupsbassi. Array is an object irrespective of what does it store (object or primitive).
I agree with Amitkumar Panchal who agrees with gurpsbassi.
char[6]='h','e'','l','l'l','o'
You can't do that anyway, it wouldn't compile as you have not allocated it to any variable - just in the same way you couldn't say : char = 'b';
No by definition a primitive value is not an object. Primitives are simple data types like int, char, double. The example you have above is a String which is actually an object. Java just translates the "hello" into a string object for you.
Closed.