Solved

multiple char primitive data type

Posted on 2016-08-09
6
31 Views
Last Modified: 2016-08-29
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
Comment
Question by:rgb192
6 Comments
 
LVL 16

Accepted Solution

by:
gurpsbassi earned 500 total points (awarded by participants)
ID: 41749075
Array of chars is considered an object.
0
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 41749087
Agree with gupsbassi. Array is an object irrespective of what does it store (object or primitive).
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 41749166
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!

 
LVL 16

Expert Comment

by:krakatoa
ID: 41750180
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
 
LVL 10

Expert Comment

by:Jeffrey Dake
ID: 41751510
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
 
LVL 16

Expert Comment

by:gurpsbassi
ID: 41774467
Closed.
0

Featured Post

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
map related example 6 59
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO) 1 57
Java class and jar 3 41
Java array sort 10 29
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question