A lower precision can be assigned to a higher precision value in Java. For example a byte type data can be assigned to int type.

Options
- True
- False


CORRECT ANSWER : True

Discussion Board
java

true

sachin patel 02-8-2015 11:47 PM

Conversion from lower precision to higher precision

Conversion is what we call when trying to convert from one type to another type. It is possible to have lower precision value assigned to higher precision values. For example:

byte to short, int, long, float, or double

short to int, long, float, or double

char to int, long, float, or double

int to long, float, or double

long to float or double

float to double

Converting from one type to another type doesn't always result in loosing of the information but it can sometimes result in unexpected situations. For example: conversion of an int or a long value to float, or of a long value to double, may result in loss of precision.

Rohit Sharma 07-28-2014 03:39 AM

Value assignment in Java

In java, we can assign a byte into an integer, and integer into a long. But trying to assign to a variable of lower precision generates a compile time error.

Value assignment in Java 07-6-2013 01:29 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement