University stuff.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

123456789101112131415161718192021222324252627
  1. class Bol<T> {
  2. private T dyr;
  3. Bol() {
  4. this.dyr = null;
  5. }
  6. Bol(T dyr) {
  7. this.dyr = dyr;
  8. }
  9. public boolean erTomt() {
  10. return dyr == null;
  11. }
  12. public void settInn(T dyr) throws Exception {
  13. if (!erTomt()) {
  14. throw new Exception("Bolet er ikke tomt!");
  15. }
  16. this.dyr = dyr;
  17. }
  18. public T hent() throws Exception {
  19. return dyr;
  20. }
  21. }