Java Quiz no2

Τι θα τυπώσει ο παρακάτω κώδικας?

-SmallBean{a=5, b=500}
-SmallBean{a=1, b=3}
-RunTime Exception
-Δεν θα κάνει compile

Αιτιολογήστε το στα σχόλια

 


[code language=”java”]
package javaapplication1;

/**
*
* @author TENANTS\diakogiannisa
*/
public class JavaApplication1 {

SmallBean playWithThoseNumbers(final Long a, final Long b, final SmallBean sb) {
sb.setA(a);
sb.setB(b);
return sb;
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Long a = 1l;
Long b = 3l;

JavaApplication1 ja = new JavaApplication1();
SmallBean inputData = new SmallBean(50l, 500l);
SmallBean sb = ja.playWithThoseNumbers(a, b, inputData);

System.out.println(sb);

}

}

class SmallBean {

public SmallBean(Long a, Long b) {
this.a = a;
this.b = b;
}

public SmallBean() {
}

private Long a;
private Long b;

public Long getA() {
return a;
}

public void setA(Long a) {
this.a = a;
}

public Long getB() {
return b;
}

public void setB(Long b) {
this.b = b;
}

@Override
public String toString() {
return "SmallBean{" + "a=" + a + ", b=" + b + ‘}’;
}

}

[/code]

Passionate Archer, Runner, Linux lover and JAVA Geek! That's about everything! Alexius Dionysius Diakogiannis is a Senior Java Solutions Architect and Squad Lead at the European Investment Bank. He has over 20 years of experience in Java/JEE development, with a strong focus on enterprise architecture, security and performance optimization. He is proficient in a wide range of technologies, including Spring, Hibernate and JakartaEE. Alexius is a certified Scrum Master and is passionate about agile development. He is also an experienced trainer and speaker, and has given presentations at a number of conferences and meetups. In his current role, Alexius is responsible for leading a team of developers in the development of mission-critical applications. He is also responsible for designing and implementing the architecture for these applications, focusing on performance optimization and security.