Miolos ciscados

Cuestionario SCJP

3 de Noviembre, 2008 · Dejar un comentario

Vou ir anotando aquí as cuestións máis problemáticas que atope nos cuestionarios Java para a certificación oficial de Sun (neste caso, o SCJP).

http://www.jchq.net/mockexams/exam3.htm

1.

What will happen when you attempt to compile and run the following code

class Base{
    public void Base(){
	System.out.println("Base");
    }
}
public class In extends Base{
    public static void main(String argv[]){
	In i=new In();
    }
}

1) Compile time error Base is a keyword
2) Compilation and no output at runtime
3) Output of Base
4) Runtime error Base has no valid constructor

2.

What will happen when you attempt to compile and run the following class?

class Base{
Base(int i){
    System.out.println("Base");
    }
}

class Severn extends Base{
public static void main(String argv[]){
        Severn s = new Severn();
    }
void Severn(){
         System.out.println("Severn");
    }
}

1) Compilation and output of the string “Severn” at runtime
2) Compile time error
3) Compilation and no output at runtime
4) Compilation and output of the string “Base”

3.

Which of the following statements are true?

1) The String class is implemented as a char array, elements are addressed using the stringname[] convention
2) The + operator is overloaded for concatenation for the String class
3) Strings are a primitive type in Java and the StringBuffer is used as the matching wrapper type
4) The size of a string can be retrieved using the length property

Categorías: ¿Programación?
Etiquetado: , , ,

0 respuestas hasta el momento ↓

  • Todavía no hay comentarios... Empiece usted rellenando el siguiente formulario.

Dejar un comentario