Are primitive datatypes allocated on a stack? - ProProfs Discuss
Advertisement

Are primitive datatypes allocated on a stack?

Are primitive datatypes allocated on a stack?

Change Image    Delete



Asked by Rinternational, Last updated: Dec 15, 2024

+ Answer
Request
Question menu
Vote up Vote down

3 Answers

drsogden

drsogden

drsogden
Drsogden

Answered Apr 10, 2018

If the primitive type is in an Object Array is it on a stack?:

Object[] data = {1, 2, 3, 4}

The array {1, 2, 3, 4} is on the stack of the Context as a pointer, not the primitive values. So there is a case where tis is niot true?

upvote downvote
Reply 

Markda John

Markda John

Markda John
Markda John

Answered Jan 02, 2018

This is true. Primitive data types are typically allocated to a stack. The stack is really just the data needed to execute a certain program, so the type of primitive data in the stack changes as different programs are executed in Javascript. For those who are not familiar with Java programming, there are eight different kinds of primitive data types in this programming language. They are boolean, byte, char, short, int, long, float, and double.

These data types have different abilities and different responsibilities in a program, but that would take a lot of explaining. There’s not enough room here to go into that, so for now, this is all you need to know about them: they are allocated to a stack when a program is executed.

upvote downvote
Reply 

John Smith

John Smith

John Smith
John Smith

Answered Oct 30, 2016

True
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.