Skip to content

Instantly share code, notes, and snippets.

@boostit
Last active December 11, 2017 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save boostit/5a884a68e222ebbe8731296e33fcdf94 to your computer and use it in GitHub Desktop.
Save boostit/5a884a68e222ebbe8731296e33fcdf94 to your computer and use it in GitHub Desktop.
Can you spot the errors in the code? Tell us in the comments below.
class BoostIT implements Angajeaza {
public static String XP_LEVEL = "Senior";
public Set<Senior> seniors = new HashSet<Senior>;
public Set Cautam(List<Developer> devs) {
for (Developer d : devs) {
if (d.stieJava().equals(XP_LEVEL)) {
seniors.add(d);
}
}
for (Senior s : seniors) {
angajam(s);
}
}
public void Angajam(Senior senior) {
System.out.println("Angajam Senior JAVA developer!");
System.out.println("Spune-ne ce greseli gasesti in");
System.out.println("codul acestui anunt verbose");
System.out.println("si poti castiga");
System.out.println("o cafea la un interviu :)");
}
}
```
@mariusbalanuca
Copy link

public class BoostIT {
public static String XP_LEVEL = "Senior";
public Set seniors = new HashSet();

public Set cautam(List<Developer> devs) {
    for (Developer d : devs) {
        if (d.stieJava().equals(XP_LEVEL)) {
            seniors.add(d);
        }
    }
    for (Senior s : seniors) {
        angajam(s);
    }
    return seniors;
}

public void angajam(Senior senior) {
    System.out.println("Angajam Senior JAVA developer!");
    System.out.println("Spune-ne ce greseli gasesti in");
    System.out.println("codul acestui anunt verbose");
    System.out.println("si poti castiga");
    System.out.println("o cafea la un interviu :)");
}
  • In situatia in care Developer extends Senior, stieJava() returneaza un String

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment