¡GoConqr estrena diseño! Cuéntanos qué te parece.

Test

Week 5 Inheritance, Polymorphism, and Interfaces

Troy Bowlin 4 preguntas Actualizado el 11 oct 2016

Hacer el test

Preguntas del test (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

Información

Descripción
Test sobre Week 5 Inheritance, Polymorphism, and Interfaces, creado por Troy Bowlin el 10/10/2016.
Idioma
English
Visitas
1
Historial
Creado el 10 oct 2016 · actualizado el 11 oct 2016
Valoración
Aún sin valoraciones
Valora este test
Valora este test

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?