I have a class called date:
public class Date{
private String monthAndDate;
public Date(String inputMonthAndDate){
monthAndDate = inputMonthAndDate;
}
}
I have another class called Patient. Is it possible to get the syntax of monthAndDate from class Date and pass it to a private field in the class Patient?
Thank you.
Note: you should avoid naming classes with names already used by the standard JDK.
To answer your question, you can simply provide a getter in your Date class:
You can now call: