logo

Crowdly

Browser

Add to Chrome

ASIX M03 - Programació bàsica (2024/2025)

Looking for ASIX M03 - Programació bàsica (2024/2025) test answers and solutions? Browse our comprehensive collection of verified answers for ASIX M03 - Programació bàsica (2024/2025) at moodle.elpuig.xeill.net.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

¿Qué imprime este código?

 

class A {

int valor = 100;

}

 

public class Test {

public static void main(String[] args) {

A a1 = new A();

A a2 = a1;

a2.valor = 200;

System.out.println(a1.valor);

}

}

0%
0%
0%
0%
View this question

¿Cuál es la salida del siguiente código?

class Punto {

int x;

 

Punto(int x) {

this.x = x;

}

 

void mover(int dx) {

x += dx;

}

}

 

public class Test {

public static void main(String[] args) {

Punto p = new Punto(3);

p.mover(2);

System.out.println(p.x);

}

}

 

View this question

¿Qué significa que un atributo o un método tengan el nivel de acceso protegido (protected)?

View this question

¿Cuál es la salida?

 

class Test {

public static void main(String[] args) {

    System.out.println("Hola " + 5 + 3);

}

}

0%
0%
0%
0%
View this question

¿Qué imprime?

 

class Coche {

static int contador = 0;

Coche() {

contador++;

}

}

public class Test {

public static void main(String[] args) {

new Coche();

new Coche();

System.out.println(Coche.contador);

}

}

View this question

¿Cuál es el resultado de este código?

class A {

A() {

System.out.print("A");

}

}

class B extends A {

B() {

System.out.print("B");

}

}

class C extends B {

C() {

System.out.print("C");

}

}

public class Test {

public static void main(String[] args) {

new C();

}

}

0%
0%
0%
0%
View this question

¿Por qué falla la siguiente clase?

 

public final class Persona {

private final String nombre;

private final int edad;

 

public Persona(String nombre, int edad) {

this.nombre = nombre;

this.edad = edad;

}

public String getNombre() {

return nombre;

}

public void setEdad(int nuevaEdad) {

this.edad = nuevaEdad;

}

}

0%
0%
0%
0%
View this question

class Punto {

int x, y;

 

Punto(int x, int y) {

this.x = x;

this.y = y;

}

}

 

public class Test {

public static void main(String[] args) {

Punto[] puntos = new Punto[2];

puntos[0] = new Punto(1, 2);

System.out.println(puntos[0].x);

}

}

View this question

¿Qué es el polimorfismo?

View this question

¿Qué palabra clave evita que un método sea sobreescrito?

View this question

Want instant access to all verified answers on moodle.elpuig.xeill.net?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome