Home » JAVA Programming » Variable Types » Question
  1. What is the output of this program?

    public class dynamic_initialize
    {
    public static void main(String args[])
    {
    double p, q;
    p = 4.5;
    q = 10.0;
    double r = Math.sqrt(p * p + q * q);
    System.out.println(r);
    }
    }
    1. 11.965
    2. 10.965
    3. 10.965856099730654
    4. 12.965
    5. 10.865856099730654
Correct Option: C

Variable c has been dynamically initialized to square root of a * a + b * b, during run time.
output: 10.965856099730654



Your comments will be displayed only after manual approval.