Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
Would a double to int type conversion be considered implicit type conversion?

Let's say I converted double x to an int, which can be done automatically through truncation. Would this be considered implicit conversion still? Is implicit conversion not being able to translate the actual value from one type to another type without losing any accuracy to that value. In this case would I not be losing the decimal part to x's value? I could not find anything specific in the java docs about this, so I thought to ask here:

double x = 420.69;
int y = x;
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

That is not an implicit conversion and this will result to compiler error.

double x = 420.69;
int y = x;

Since double is a bigger data type than int, it needs to be down-casted.

double x = 420.69;
int y = (int)x;

However,all the digits after the decimal will be lost.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!