Ad
  • Custom User Avatar

    Automatic typecasting during overlapping assignment (+=, *=, ...) :
    sum += Math.pow();

    Explicit type casting:
    sum = sum + (int) Math.pow();

  • Default User Avatar

    this is strange. When I write this code:

    int sum = Math.pow(1,2);

    I will get an error message which says: "Cannot convert from double to int".

    But why does your notation ->> sum += Math.pow(); works?

    if you rewrite this to -> sum = sum + Math.pow(); <<- it wont work!

    Could you please explain?