Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 36
  • Last Modified:

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?
0
rgb192
Asked:
rgb192
1 Solution
 
gurpsbassiCommented:
Array of chars is considered an object.
0
 
Amitkumar PanchalSr. 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now