Search:

Type: Posts; User: TmDee

Search: Search took 0.13 seconds.

  1. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    This SHOULD BE the console:

    Jordan d34
    d34 Jordan
    Jordan null
    d34 null
    Jordan d34
    d34 Jordan
    Jordan null
    d34 null
  2. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    I think my code says.

    Make a Patient with naam: Jordan.
    Then make a bed with nummer d34.
    Then setBed(b1) does sets the number d34 to patient p1.
    So when we print out p1 it return naam: Jordan...
  3. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    Yes thank you I get that but I sorry, I can't see in my code where an variable is null, before I use a method to delete an variable.
  4. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    Okay, I see but I still don't get it why it gives that null error, I probably should just wait and ask to my prof
  5. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    Yes indeed it becomes null with the method, verwijderBed then it's says the value to zero but never before. I don't see it where it is null in the beginning do you?
  6. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    I don't know why it's null, none of the variables is null from the object I try to print out.

    The console should be:


    Jordan d34
    d34 Jordan
    Jordan null
    d34 null
    Jordan d34
  7. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    Don't get how it can give null value if I print the variables b1.getNummer() en p1.getNaam() it gives the values I want but when I put it in the toString methode it gives an error like you said a...
  8. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    public class Bed {
    private String nummer;
    private Patient patient;

    public String toString() {
    return nummer +" " + patient.getNaam();
    }


    public Bed(String num) {
  9. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    I searched a bit more but apparently it's an excercise about a subject that we haven't learn yet, so i'll be probably in the weekend back on to this!
  10. Replies
    19
    Views
    1,679

    Re: Errors while printing out

    I see so I deleted this from line 7 for both classes and it only prints out


    Jordan
    d34
    Jordan
    d34
    Jordan
    d34
    Jordan
  11. Replies
    19
    Views
    1,679

    Errors while printing out

    This is the main:


    public class main {
    public static void main(String[] args) {
    Patient p1 = new Patient("Jordan");
    Bed b1 = new Bed("d34");
    p1.setBed(b1);
    System.out.println(p1);...
Results 1 to 11 of 11