Online Test for Java

  1. int x[] = new int[]{10,20,30};<br><br>Arrays can also be created and initialize as in above statement.
    True
    False

  1. The modifiers public and static cannot written in either order "public static" or "static public".
    True
    False


  1. If you access an uninitialized local variable will result?
    Syntax Error
    Compile Time Error
    Run Time Error
    No Error

  1. A constructor that is automatically generated in the absence of explicit constructors called?
    Default Constructor
    Nullary Constructor
    Empty Constructor
    All the above

  1. Assignment operator is evaluated Left to Right.
    True
    False

  1. Which is right way to creating an array of integer?
    javaArray = new int[10];
    javaArray new = myArray[10];
    int[] javaArray = new int[10];
    A and C Both


  1. Which keyword is used to inherit class?
    inherit
    extends
    inheritance
    extend

  1. Which of these is a super class of all errors and exceptions in the Java language?
    RunTimeExceptions
    Throwable
    Catchable
    None of the above

  1. To override a method in Java, we need to define a method in sub class with the
    same name, same number of arguments having the same data types as a method in the super class
    different name, same number of arguments having the same data type as a method in the super class
    same name but different number of arguments as a method in the super class
    same name, same number of arguments but different data types as a method in the super class

Post Your Question
Social Sharing
Search