Java JNI Question:
Download Questions PDF

Why does Java have different data types for integers and floating-point values?

Answer:

The integer and floating-point types are different in terms of the consumption of the bits which represent them. There are certain data types which are rightly apt for speed and perfect memory utilization. This makes the java applications to execute with efficiency. For example the number 95 is within the range of byte, short, int and long integer types. The data type byte will occupy 8 bits, short occupies 16 bits, and int occupies 32 bits and long 64 bits. If the variable is restricted to hold only the values -128 to +127, then throughout the application it is wise to declare that variable as ‘byte’. Similar applicability is applied for the rest of integer types and floating-point types.

Download Java JNI Interview Questions And Answers PDF

Previous QuestionNext Question
Define JNI functions and pointers?What is finalize()? Is finalize() similar to a destructor?