Object & Classes


  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.



  1. What is the output of this program?
    class N 
    {
    int p;
    double q;
    }
    class M extends N
    {
    int r;
    }
    public class Output
    {
    public static void main(String args[])
    {
    N p = new N();
    M q = new M();
    Class object;
    object = p.getClass();
    System.out.print(object.getName());
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    getClass() is used to obtain the class of an object, here ‘p’ is an object of class ‘N’. hence a.getClass() returns ‘N’ which is stored in class Class object object.


  1. Which of these class defines how the classes are loaded?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    ClassLoader



  1. Which of these keywords cannot be used for a class which has been declared final?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    A abstract class is incomplete by itself and relies upon its subclasses to provide complete implementation. If we declare a class final then no class can inherit that class, an abstract class needs its subclasses hence both final and abstract cannot be used for a same class.