Click here to watch on Youtube:
https://www.youtube.com/watch?v=AvaWHGgkqDU&list=UUhwKlOVR041tngjerWxVccw
PeriodDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/PeriodDemo_get_unit.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/PeriodDemo_get_unit
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/755fea7aeca931764d09d2ae6d0900a44d7186bb/BasicJava_2018/PeriodDemo_get_unit/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
Cooking Tutorial
https://www.youtube.com/watch?v=AvaWHGgkqDU&list=UUhwKlOVR041tngjerWxVccw
PeriodDemo.java
import java.time.Period;
import java.time.temporal.ChronoUnit;
public class PeriodDemo
{
public static void main(String[] args)
{
Period period = Period.ofMonths(12);
System.out.println("period = "+period);
/*
* Parameters:
*
* unit - the TemporalUnit for which to return the value
*
* Returns:
*
* the long value of the unit
*/
long monthValue = period.get(ChronoUnit.MONTHS);
System.out.println("monthValue = "+monthValue);
}
}
import java.time.temporal.ChronoUnit;
public class PeriodDemo
{
public static void main(String[] args)
{
Period period = Period.ofMonths(12);
System.out.println("period = "+period);
/*
* Parameters:
*
* unit - the TemporalUnit for which to return the value
*
* Returns:
*
* the long value of the unit
*/
long monthValue = period.get(ChronoUnit.MONTHS);
System.out.println("monthValue = "+monthValue);
}
}
Output
period = P12M
monthValue = 12
monthValue = 12
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/PeriodDemo_get_unit.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/PeriodDemo_get_unit
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/755fea7aeca931764d09d2ae6d0900a44d7186bb/BasicJava_2018/PeriodDemo_get_unit/?at=master
See also:
No comments:
Post a Comment