Home › Java Tutorial › Java packages, imports and dates
Java packages, imports and dates
Use classes from the standard library.
Classes are grouped in packages such as java.util and java.time. import lets you use them by short name; java.lang (String, Math, System) is imported automatically. LocalDate handles dates without time zones.
Example code
import java.time.LocalDate;
public class Main {
public static void main(String[] args) {
LocalDate d = LocalDate.of(2026, 1, 15);
System.out.println(d.plusDays(20));
System.out.println(d.getDayOfWeek());
}
}