+ 7

What really is "int"

Hi, I am trying to understand were int comes from? were is the information stored for the primitive types? how does the complier know that int will return a number?? I understand how strings work beacuse they are objects of class but primitive type makes no sense to me any help plz?

21st Jan 2019, 9:15 PM
Aura
Aura - avatar
9 Answers
+ 13
Computer hardware has two primitives types: integer and real. The hardware has instructions to manipulate these types usually with a few different sizes. The integers are also treated as addresses when needed. Characters are an one byte integer dealt with by libraries or system calls not hardware. Languages like Java build their primitives on top of the hardware ones.
21st Jan 2019, 11:02 PM
John Wells
John Wells - avatar
+ 7
I found this i cant be certain if its correct as i have never really looked deep into were the primitive types come from i only know how they can be used...anyway. Any data type built-in to a programming language is called primitive data type. Words primitive or built-in or basic data types are used interchangeably by authors. Primitive data types in Java are provided by the Java programming language as a basic building block and for that they are called primitive types to Java. Java also allows programmers to define their own types (user defined types). For primitive types Java has built-in support. Primitive types are predefined by the Java language and are named by a reserved keywords. Java supports 8 built-in data types and their basic behavior and supported operations cannot be modified by programmers. John Wells Danijel Ivanović
21st Jan 2019, 10:32 PM
D_Stark
D_Stark - avatar
+ 4
When we talk about integers in computer programming languages like Java, we are talking about a memory location, or locations, that hold a non-decimal or non-fractional number or numbers, both positive and negative. ‱ The keyword 'int' represents an integer type, a description of the memory that is used to hold the value.
21st Jan 2019, 10:40 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 2
An int is also known as an integer. It's a number that is stored on 4 bytes in the memory (one byte = 8 bits). You can store value from 0 to 2**32 - 1. To learn more, learn c language.
21st Jan 2019, 9:54 PM
Théophile
Théophile - avatar
+ 2
In general Integers are whole numbers (positive, negative and zero). See other answers above.
23rd Jan 2019, 12:27 AM
Sonic
Sonic - avatar
+ 1
In JAVA signed from -2147483648 to + 2147483647
21st Jan 2019, 10:27 PM
PapaBT
PapaBT - avatar
+ 1
For example: String is an Object, intern represeted by an Array of char. char is a primitiv datatype.
21st Jan 2019, 10:50 PM
PapaBT
PapaBT - avatar
0
IN JAVA DATATYPES ARE CATOGARIZED INTO 2 TYPES 1 PRIMITIVE 2 REFERENCE PRIMITIVE ======== int char float double REFERENCE ========== array string every object rated to predefined or userdefined classes/interfaces Therefore int is a primitive datatype that stores numbers or integers having 4 bytes of memory
23rd Jan 2019, 9:52 AM
sree harsha
sree harsha - avatar