Reputation: 127
Why can't I use GregorianCalendar as an object type as a constructor parameter?
public class P(GregorianCalendar date){
Why can't I do this?
The error it give me is "syntax error on token "class", char expected".
Upvotes: 1
Views: 98
Reputation: 5568
As Jon Skeet mentioned in the comments. Here is how you create a class with construtor that has one parameter
import java.time.LocalDate;
public class P {
private LocalDate date;
public P(LocalDate date){
this.date = date;
}
}
Upvotes: 2