Java Date Time - Year length() example








Year length() gets the length of this year in days.

Syntax

length has the following syntax.

public int length()

Example

The following example shows how to use length.

import java.time.Year;
/*from  w ww . j  ava  2 s  .  c o m*/
public class Main {
  public static void main(String[] args) {
    Year y = Year.of(2014);

    System.out.println(y.length());

  }
}

The code above generates the following result.