Tag: programming languages

Questions Related to programming languages

  1. void run();

  2. protected void go();

  3. static void get();

  4. public abstract set();

  5. none of these


Correct Option: A
  1. interface declares constant and instance variables.

  2. The abstract modifier can be combined with the static modifier .

  3. native modifier can be applied only on method.

  4. synchronized modifier can be applied to method as well as class.

  5. none of these


Correct Option: C
  1. class cons{ cons() { } public void cons(); public static void main (String[] aa){ cons b=new cons(); } }

  2. public class cons { cons() { } public cons(int x,int y) { System.out.print(x +" "+ y); } public static void main (String[] aa){ cons b=new cons(); cons obj=new cons(4,2); } }

  3. public class cons { public cons(int x) { System.out.print(x); } public static void main (String[] aa){ cons b=new cons(); } }

  4. class cons{ cons() { } public float foo () { double f = 32; return f; } public static void main (String[] aa){ cons b=new cons(); } }


Correct Option: B
  1. A static method may override another static method

  2. A static method cannot override a non-static method

  3. A non-static method cannot override a static method

  4. A non-static method may be overloaded by a static method

  5. A synchronized method cannot be overridden


Correct Option: B,C,D