Methods


  1. Which of these method can set the out stream to OutputStream?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    setOut()


  1. What is the output of this program?
    public class Output 
    {
    public static void main(String args[])
    {
    double num0 = 5.0;
    double num1 = 2.0;
    double num2 = Math.pow( num0, num1 );
    System.out.print(num2);
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Math.pow(num0, num1) methods returns value of num1 to the power num0, i:e num0 ^ num1, 5.0 ^ 2.0 = 25.0



  1. What is the output of this program?
    public class Result 
    {
    public static void main(String args[])
    {
    double num0 = 4.15;
    double num1 = 5.16;
    double num2 = Math.max( num0, num1 );
    System.out.print(num2);
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    5.16


  1. What is the output of this program?
    public class Math_Example 
    {
    public static void main(String args[])
    {
    int num0 = 10;
    int num1 = (int) Math.abs(num0);
    System.out.print(num1);
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    10



  1. What is the output of this program?
    public class Result 
    {
    public static void main(String args[])
    {
    byte array0[] = { 71, 72, 73, 74, 75, 76 };
    byte array1[] = { 77, 78, 79, 80, 81, 82 };
    System.arraycopy(array0 , 1, array1, 3, 0);
    System.out.print(new String(array0) + " " + new String(array1));
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Since last parameter of System.arraycopy(array0, 1, array1, 3, 0) is 0 nothing is copied from array a to array b, hence b remains as it is.