Object & Classes


  1. What is the output of this program?

    class N
    {
    int K;
    int L;
    N()
    {
    K = 1;
    L = 2;
    }
    }
    public class Result
    {
    public static void main(String args[])
    {
    N object = new N();
    System.out.print(object.toString());
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    toString() is method of class Object, since it is superclass of every class, every object has this method. toString() returns the string associated with the calling object.


  1. Which of these classes encapsulate runtime state of an object?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Class



  1. Which of these methods returns the class of an object?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    getClass()


  1. Which of these is a process of converting a simple data type into a class?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    type wrapping



  1. Which of these classes is not included in java.lang?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Array class is a member of java.util.