Hello there,
In my program I have an object of a class with some values, and I am trying to create another object, populate it to array and add it to my object.
class AdvertisementType {
public String getWebAdvert() {
return webAdvert;
}
public String getEmailAdvert() {
return emailAdvert;
}
private String webAdvert;
private String emailAdvert;
AdvertisementType(String webAdvert, String emailAdvert){
this.webAdvert = webAdvert;
this.webAdvert = emailAdvert;
}
}
public class ProjectManager {
DisplayClientRequest b;
public void viewRequest(){
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMMM-yyyy");
String printDate = sdf.format(date);
AdvertisementType ad = new AdvertisementType("web", "newspaper");
AdvertisementType[] first = new AdvertisementType[1];
first[0] = ad;
DisplayClientRequest request1 = new DisplayClientRequest("Bartosz", "Mirowski", printDate, first );
System.out.println(request1.getName() + " " + request1.getSurname() + " " + request1.getDate() + Arrays.toString(request1.getAdvertisementType()));
}
}
package busypointltd;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
/**
*
* @author Bartosz
*/
public class DisplayClientRequest {
private String name;
private String surname;
private String date;
private AdvertisementType[] advertisementType;
public DisplayClientRequest(String name, String surname, String date, AdvertisementType[] advertisementType) {
this.name = name;
this.surname = surname;
this.date = date;
this.advertisementType = advertisementType;
}
public String getName() {
return name;
}
public String getSurname() {
return surname;
}
public String getDate() {
return date;
}
public AdvertisementType[] getAdvertisementType() {
return advertisementType;
}
}
In DisplayClient Request i have an array passed to constructor of type AdvertisementType, and in AdvertisementType I have some Strings passed to constructor as well, then in ProjectManager class I am creating an object of it and trying to put array in other object. When i try to print out, it doesnt work.. I tried using algorithms for printing and Arrays.toString.. any suggestions ??
Thank you in advance