Constructors , paprameters and super
When i instantiate an object with parameters " SubClient clientobjecttest = new SubClient(fsname,lsname,tphone,adss); "
my code kicks out the following error
C:\J2SDK1~1.2_0\BIN>javac reportprogram.java
reportprogram.java:169: cannot resolve symbol
symbol : constructor SubClient (java.lang.String,java.lang.String,int,java.lang
.String)
location: class SubClient
SubClient clientobjecttest = new SubClient(fsname,lsname,tphone,adss);
^
Thing is, if I don’t include the parameters, it compiles ok, so I suspect I need to use super so I inserted it by where it says problem 1 in the code.
Still I have this problem. Please could you help.
Code:
class Person{
void Person(String fsname,String lsname,int tphone,String adss) {
}
// as of this moment i am unsure of how data will getinto these variable possile by the use of super
String firstname;
String lastname;
String address;
int telephonenumber;
}
class SubClient extends Person {
//creating a constructor to get variables ,because i dont seem to be able to the the class to exten as well as
//take parameters.
void SubClient(String fsname,String lsname,int tphone,String adss) {
super(fsname,lsname,tphone,adss); // PROBLEM 1
String testvalue = "test";
super.firstname = fsname;
super.lastname = lsname;
super.telephonenumber =tphone;
super.address = adss;
System.out.println(testvalue);
// the line above is only for test
}
void printclientdetails() {
}
}
class reportprogram {
public static void main(String args[])throws IOException{
// thes variables for testing
String destina = "paris";
String flightno = " ch102";
int noofcargo = 4;
char cargoclass = 'd';
//PROBLEM 2
//SubClient clientobjecttest = new SubClient(fsname,lsname,tphone,adss);
PROBLEM 3
SubClient clientobjecttest = new SubClient();
}