I was wondering how to create an instance of an object that takes a String[] type as a parameter. So far it comes up with an error saying that I cannot initialise an array when creating a new instance. This is my code:
public class Profile{
public Profile(String[] interests) {
this.interests = interests;
}
}
public class ProfileTest{
public static void main(String[] args) {
//Where the error appears
Profile newProfile = new Profile({"Interest1","Interest2","Interest3"});
}
}
I don't want to use an arraylist or anything - just String[].