Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda