C:\CXS\WEB-INF\classes%26gt;javac AddGuest.java
AddGuest.java:14: Guest(java.lang.String) in
com.selectv.cxs.billing.Guest
cannot be applied to ()
Guest aGuest = new Guest ();
^
1 error
%26gt; That's the error that occur, may i know what it means %26amp; how to solve it?
Java question...?
The Guest class has a constructor that takes a String, but you are calling it with no parameter. You need to change
Guest aGuest = new Guest ();
to something like
Guest aGuest = new Guest ("The guest's name");
Reply:You need to overload your constructor method to take a parameter of type String.
Essentially your compiler is looking for "Guest( String name )" and finding only "Guest()".
Fix it by writing a second constructor method with the signature Guest( String name ) .
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment