Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Errors while printing out

  1. #1
    Junior Member
    Join Date
    Feb 2019
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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);
    		System.out.println(b1);
    		b1.verwijderPatient();
    		System.out.println(p1);
    		System.out.println(b1);
    		b1.setPatient(p1);
    		System.out.println(p1);
    		System.out.println(b1);
    		p1.verwijderBed();
    		System.out.println(p1);
    		System.out.println(b1);
    	}
     
    }

    This is the first object Bed:
    public class Bed {
    	private String nummer;
    	private Patient patient;
     
    	public String toString() {
    		return nummer +" " + patient;
    	}
     
     
    	public Bed(String num) {
    		nummer = num;
    	}
     
    	public void verwijderPatient() {
    		patient = null;
     
    	}
     
    	public void setPatient(Patient p) {
    		patient = p;
    	}
     
    }

    This is the second object Patient:
    public class Patient {
    	private String naam;
    	private Bed bed;
     
    	public String toString() {
    		return naam +" "+ bed;
    	}
     
    	public Patient(String na) {
    		naam = na;
     
    	}
     
    	public void setBed(Bed b) {
    		bed = b;
    	}
     
    	public void verwijderBed() {
    		bed = null;
     
    	}
     
    }

    This is the console:
    Jordan d34 null
    d34 null
    Jordan d34 null
    d34 null
    Exception in thread "main" java.lang.StackOverflowError
    	at java.lang.AbstractStringBuilder.append(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at java.lang.StringBuilder.<init>(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.lang.StringBuilder.append(Unknown Source)
    	at Patient.toString(Patient.java:7)

    Don't understand what's wrong about it and I think the relation between bed and patient isn't quite right and I prints out null where it doesn't need to.
    Any help? I would appreciate it I'm a student in Industrial Ingeneering in my first year from Belgium.

    Thanks in regards.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,914
    Thanks
    52
    Thanked 2,336 Times in 2,292 Posts

    Default Re: Errors while printing out

    Exception in thread "main" java.lang.StackOverflowError
    at java.lang.AbstractStringBuilder.append(Unknown Source)
    at java.lang.StringBuilder.append(Unknown Source)
    at java.lang.StringBuilder.<init>(Unknown Source)
    at Patient.toString(Patient.java:7)
    at java.lang.String.valueOf(Unknown Source)
    at java.lang.StringBuilder.append(Unknown Source)
    at Bed.toString(Bed.java:7)
    ... repeats
    Normally you get that error when the code has an infinite recursive loop.
    It looks like the Patient and Bed objects are calling each other. Look at the code at line 7 in both classes.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2019
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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
    d34

    This are just the first things and these are ofcourse correct. So I must find a way to print out the object from the other class without calling each other out all the time. I'll take a look thanks!

  4. #4
    Junior Member
    Join Date
    Feb 2019
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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!

  5. #5
    Junior Member
    Join Date
    Feb 2019
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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) {
    		nummer = num;
     
    	}
     
     
    	public void verwijderPatient() {
    		patient = null;
     
    	}
     
    	public String getNummer() {
    		return nummer;
    	}
     
    	public void setPatient(Patient p) {
    		patient = p;
    	}
     
    }

    public class Patient {
    	private String naam;
    	private Bed bed;
     
    	public String toString() {
    		return naam +" " + bed.getNummer();
    	}
     
    	public Patient(String na) {
    		naam = na;
     
    	}
     
    	public void setBed(Bed b) {
    		bed = b;
    	}
     
    	public void verwijderBed() {
    		bed = null;
     
    	}
     
    	public String getNaam() {
    		return naam;
    	}
     
    }

    Jordan d34
    Exception in thread "main" java.lang.NullPointerException
    	at Bed.toString(Bed.java:7)
    	at java.lang.String.valueOf(Unknown Source)
    	at java.io.PrintStream.println(Unknown Source)
    	at main.main(main.java:8)

    I changed the toString methode in both classes and now the first line of the console is correct but then it gives this error, tips?

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,914
    Thanks
    52
    Thanked 2,336 Times in 2,292 Posts

    Default Re: Errors while printing out

    Exception in thread "main" java.lang.NullPointerException
    at Bed.toString(Bed.java:7)
    There is a variable on line 7 that has a null value when line 7 is executed. Find the variable (print it if needed) and then backtrack in the code to see why the variable does not have a valid value.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 7
    Last Post: May 8th, 2014, 12:51 PM
  2. Replies: 3
    Last Post: March 6th, 2012, 02:50 AM
  3. Replies: 1
    Last Post: September 28th, 2011, 07:29 AM
  4. help with errors
    By hello_world in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 9th, 2011, 09:11 PM
  5. [SOLVED] Printing Array without printing empty elements
    By CarlMartin10 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 12th, 2010, 02:41 AM