Click here to watch on Youtube:
https://www.youtube.com/watch?v=QRoVL_9BwU8&list=UUhwKlOVR041tngjerWxVccw
DayOfWeekDemo1.java
Output
DayOfWeekDemo2.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/DayOfWeekDemo_minus_plus.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/DayOfWeekDemo_minus_plus
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/23d89f367bac9ed4230eafe0abaf49c0a80cc445/BasicJava_2018/DayOfWeekDemo_minus_plus/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Spring Tutorial
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
Cooking Tutorial
https://www.youtube.com/watch?v=QRoVL_9BwU8&list=UUhwKlOVR041tngjerWxVccw
DayOfWeekDemo1.java
import java.time.DayOfWeek;
public class DayOfWeekDemo1
{
public static void main(String[] args)
{
DayOfWeek dayOfWeek = DayOfWeek.of(5);
System.out.println("dayOfWeek = " + dayOfWeek);
/*
* Parameters:
*
* days - the days to subtract, positive or negative
*
* Returns:
*
* the resulting day-of-week, not null
*/
dayOfWeek = dayOfWeek.minus(2);
System.out.println("dayOfWeek = " + dayOfWeek);
}
}
public class DayOfWeekDemo1
{
public static void main(String[] args)
{
DayOfWeek dayOfWeek = DayOfWeek.of(5);
System.out.println("dayOfWeek = " + dayOfWeek);
/*
* Parameters:
*
* days - the days to subtract, positive or negative
*
* Returns:
*
* the resulting day-of-week, not null
*/
dayOfWeek = dayOfWeek.minus(2);
System.out.println("dayOfWeek = " + dayOfWeek);
}
}
Output
dayOfWeek = FRIDAY
dayOfWeek = WEDNESDAY
dayOfWeek = WEDNESDAY
DayOfWeekDemo2.java
import java.time.DayOfWeek;
public class DayOfWeekDemo2
{
public static void main(String[] args)
{
DayOfWeek dayOfWeek = DayOfWeek.of(5);
System.out.println("dayOfWeek = " + dayOfWeek);
/*
* Parameters:
*
* days - the days to add, positive or negative
*
* Returns:
*
* the resulting day-of-week, not null
*/
dayOfWeek = dayOfWeek.plus(1);
System.out.println("dayOfWeek = " + dayOfWeek);
}
}
public class DayOfWeekDemo2
{
public static void main(String[] args)
{
DayOfWeek dayOfWeek = DayOfWeek.of(5);
System.out.println("dayOfWeek = " + dayOfWeek);
/*
* Parameters:
*
* days - the days to add, positive or negative
*
* Returns:
*
* the resulting day-of-week, not null
*/
dayOfWeek = dayOfWeek.plus(1);
System.out.println("dayOfWeek = " + dayOfWeek);
}
}
Output
dayOfWeek = FRIDAY
dayOfWeek = SATURDAY
dayOfWeek = SATURDAY
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/DayOfWeekDemo_minus_plus.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/DayOfWeekDemo_minus_plus
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/23d89f367bac9ed4230eafe0abaf49c0a80cc445/BasicJava_2018/DayOfWeekDemo_minus_plus/?at=master
See also:
No comments:
Post a Comment