What will be the output of following Java code (6)?

80. What will be the output of following Java code?

public class Main {
  public static void main(String[] args) {
    System.out.println(Math.copySign(100.6, -200.6));
  }
}
  1. 100.6
  2. -100.6
  3. -200.6
  4. 200.6

Answer: B) -100.6

Explanation:

The Math.copySign() returns the first floating-point argument with the sign of the second floating-point argument.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.