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?
LVL 1
rgb192Asked:
Who is Participating?
 
gurpsbassiConnect With a Mentor Commented:
Array of chars is considered an object.
0
 
Amitkumar PSr. ConsultantCommented:
Agree with gupsbassi. Array is an object irrespective of what does it store (object or primitive).
0
 
krakatoaCommented:
I agree with Amitkumar Panchal who agrees with gurpsbassi.
1
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
krakatoaCommented:
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';
0
 
Jeffrey Dake Senior Director of TechnologyCommented:
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.
0
 
gurpsbassiCommented:
Closed.
0
All Courses

From novice to tech pro — start learning today.