Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
inheritance
:
Content language: English
Русский
What is the output of the following program? public class Greek { int i = 1; public int getI() { System.out.print("Super"); return i; } public static void main(String arhs[]) { Greek ga = new Arabik(); System.out.print(ga.i + " " + ga.getI()); } } class Arabik extends Greek { int i = 2; public int getI() { System.out.print("Sub"); return i; } }
inheritance
Choose correct constructor bodies to be inserted at line (1). class Base { public Base(String s) { System.out.println("Base(" + s + ")"); } } class Sub extends Base { private static final String CLASS_DUMMY_STRING = "CLASS_DUMMY_STRING"; private final String INSTANCE_DUMMY_STRING = "INSTANCE_DUMMY_STRING"; public Sub() { //(1) } private static String getClassString() { return CLASS_DUMMY_STRING; } private String getInstanceString() { return INSTANCE_DUMMY_STRING; } }
inheritance
What is the result of compiling and running the following code: public class Main { public static void main(String[] args) { Parent p = new Parent(); Child c = new Child(); Parent p2 = new Child(); useIt(p); useIt(c); useIt(p2); } final static void useIt (Parent p){ System.out.println("Parent"); } final static void useIt (Child c){ System.out.println("Child"); } } class Parent { } class Child extends Parent { }
inheritance
In Python 2, if a class is declared using new-style classes like Child(Base), what is the correct way for a method foo() to call its base implementation?
inheritance
Select all correct ways to extend following traits. trait QuizfulOne { var value: String } trait QuizfulTwo { def value: String }
inheritance
Declaring abstract "var" members
inheritance
Given following classes: class A { int x; } class B : A { int y; } Which code fragments will compile and run successfully?
inheritance
← Prev
1
2
3
4
5
Next →
Sign Up Now
or
Subscribe for future quizzes