Hi,
I have a constructor
public Road() {
name = DEFAULT_NAME;
number = DEFAULT_NUMBER;
length = DEFAULT_LENGTH;
String read="";
read += toString(name,n umber,length);
// toString is a function which formats the data into "DEFAULT_LENGTH ,DEFAULT_NAME,D EFAULT_NUMBER, DEFAULT_NUMBER" ;
}
Then in main I have
Road roadOne = new Road();
System.out.prin tln(roadOne);
How do i get it so that it will print "DEFAULT_LENGTH ,DEFAULT_NAME,D EFAULT_NUMBER, DEFAULT_NUMBER" , without changing anything in main
I have a constructor
public Road() {
name = DEFAULT_NAME;
number = DEFAULT_NUMBER;
length = DEFAULT_LENGTH;
String read="";
read += toString(name,n umber,length);
// toString is a function which formats the data into "DEFAULT_LENGTH ,DEFAULT_NAME,D EFAULT_NUMBER, DEFAULT_NUMBER" ;
}
Then in main I have
Road roadOne = new Road();
System.out.prin tln(roadOne);
How do i get it so that it will print "DEFAULT_LENGTH ,DEFAULT_NAME,D EFAULT_NUMBER, DEFAULT_NUMBER" , without changing anything in main
Comment