Search code examples
javacastingdoubletypeconverter

Convert the int into double inside of a constructor


I have a constructor whose parameters are both int: Berries( int a, int b ) and I need to put a double in the place of "a" in the code: Berries( 23.45, 6). I tried with cast, but it does not work.

Can you help me please ?


Solution

  • the ugly solution

    new Berries((new Double(23.45)).intValue(),6)