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 20 of 20

Thread: Errors while printing out

  1. #1
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    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
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 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. The Following User Says Thank You to Norm For This Useful Post:

    TmDee (March 23rd, 2019)

  4. #3
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    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!

  5. #4
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    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!

  6. #5
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    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?
    Last edited by TmDee; March 23rd, 2019 at 02:09 PM.

  7. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 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.

  8. The Following User Says Thank You to Norm For This Useful Post:

    TmDee (March 23rd, 2019)

  9. #7
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default 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 null value. I don't get how, if i follow the path Java makes I don't get how it's wrong.

  10. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Errors while printing out

    What variable has the null value?
    Where is that variable given a value?
    Is it given a value before it is used?
    If you don't understand my answer, don't ignore it, ask a question.

  11. The Following User Says Thank You to Norm For This Useful Post:

    TmDee (March 23rd, 2019)

  12. #9
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default 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
    d34 Jordan
    Jordan null
    d34 null
    Last edited by TmDee; March 23rd, 2019 at 02:08 PM.

  13. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Errors while printing out

    none of the variables is null
    There must be one with a null value for the NullPointerException to happen.

    The console should be:
    I see some null values in that post.
    If you don't understand my answer, don't ignore it, ask a question.

  14. The Following User Says Thank You to Norm For This Useful Post:

    TmDee (March 23rd, 2019)

  15. #11
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

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

  16. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Errors while printing out

    where it is null in the beginning
    The default value for any object reference variable is null.
    The variables: naam, bed, nummer and patient all start with null values.
    If you don't understand my answer, don't ignore it, ask a question.

  17. The Following User Says Thank You to Norm For This Useful Post:

    TmDee (March 23rd, 2019)

  18. #13
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default 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

  19. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Errors while printing out

    why it gives that null error
    When a variable has a null value and the code tries to call a method with it,
    the JVM throws a NullPointerException
          String str = null;
          int len = str.length();  //str is null >> Gives  java.lang.NullPointerException
    If you don't understand my answer, don't ignore it, ask a question.

  20. #15
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

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

  21. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Errors while printing out

    I can't see in my code where an variable is null
    Here are two variables that have null values before they are assigned a valid value:
    	private String naam;
    	private Bed bed;

    delete an variable
    A variable can not be deleted. It can be assigned a value.
    What statement do you think "deletes" a variable?
    If you don't understand my answer, don't ignore it, ask a question.

  22. #17
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default 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 and bed.getNummer() should give d34.
    Then print out b1 returns nummer:d34 and then should patient.getNaam() give Jordan, but this doesn't, how?

    --- Update ---

    Quote Originally Posted by Norm View Post
    Here are two variables that have null values before they are assigned a valid value:
    	private String naam;
    	private Bed bed;


    A variable can not be deleted. It can be assigned a value.
    What statement do you think "deletes" a variable?
    And yeah but then 4th of the main gives String naam the name Jordan and Bed bed is then probably null but then with setBed() it should set bed to d34 from b1.

    And okay, you're correct it doesn't delete an value it just puts the value to null like with verwijderPatient or verwijderBed, there I was incorrect, my apologies

  23. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Errors while printing out

    patient.getNaam() give Jordan, but this doesn't,
    What does "this doesn't" mean?
    If there is an error, you need to copy the error message and post it so we know what the code does when you execute it.

    Please post the output that you are asking about and add some comments to it saying what you expect the output to be.
    If you don't understand my answer, don't ignore it, ask a question.

  24. #19
    Junior Member
    Join Date
    Feb 2019
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default 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

    But this is the console I have:
    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)
    It stops after Jordan d34, and gives like you said an Nullpointerexception, but I think I'll just ask it thursday to my prof, where probably not on the same line.
    Still thanks a lot!

  25. #20
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Errors while printing out

    Exception in thread "main" java.lang.NullPointerException
    at Bed.toString(Bed.java:7)
    There is a variable with a null value when the code on line 7 is executed.
    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, 03: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