GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Quiz

Week 5 Inheritance, Polymorphism, and Interfaces

Troy Bowlin 4 Fragen Aktualisiert am 11 Okt 2016

Quiz starten

Fragen in diesem Quiz (4)

  1. 1A class that is NOT abstract is said to be?
    1. Aconcrete
    2. Bprivate
    3. Cprotected
    4. Dpolymorphic
  2. 2Suppose a class has public visibility and defines a protected method.
    Which of the following statements is correct?
    1. AThis method is only accessible from inside the class itself and from inside all subclasses.
    2. BIn a class, you cannot declare methods with a lower visibility than the visibility of the class in which it is defined.
    3. CFrom within protected methods you do not have access to public methods.
    4. DThis method is accessible from within the class itself and from within all classes defined in the same package as the class itself.
  3. 3In the following code, which method is the constructor?
    public class theDemo{
    in val 1'
    int val2;
    public int Demo1(){
    val1 = 1;
    }
    public int Demo2(){
    val2 = 2;
    }
    public void the Demo(){
    val1 = 0;
    val2 = 0;
    }
    public void showDemo(){
    System.out.println(val1);
    }
    }
    1. ADemo1()
    2. BDemo2()
    3. CtheDemo()
    4. DshowDemo()
  4. 4Consider the following code. What will the output of the code be?
    import java.io.*;
    public class myStuff
    {
    static int num1 = 0;
    int num2;
    public static void main(String a{}) throws Exception
    {
    mystuff s1 = new myStuff();
    s1.num1 = 5;
    s1.num2 = 10;
    myStuff s2 = new myStuff();
    s2.num1 = 15;
    s2.num2 = 15;
    System.out.println("s1 num1=" +s1.num1+ " num2=" +s1.num2+" s2num1=" +s2.num1+" num2=" +s2.num2);
    }
    }
    1. As1 num1= 15 num2=10 s2 num1=15 num2=15
    2. Blkj

Informationen

Beschreibung
Quiz am Week 5 Inheritance, Polymorphism, and Interfaces, erstellt von Troy Bowlin am 10/10/2016.
Sprache
English
Aufrufe
1
Verlauf
Erstellt am 10 Okt 2016 · aktualisiert am 11 Okt 2016
Bewertung
Noch keine Bewertungen
Bewerte dieses Quiz
Bewerte dieses Quiz

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck