![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9326 Articles for Object Oriented Programming
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
470 Views
The hour of the day for a particular LocalTime can be obtained using the getHour() method in the LocalTime class in Java. This method requires no parameters and it returns the hour of the day which can range from 0 to 23.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { LocalTime lt = LocalTime.parse("15:28:35"); System.out.println("The LocalTime is: " + lt); System.out.println("The hour is: " + lt.getHour()); } }outputThe LocalTime is: 15:28:35 The hour is: 15Now let us ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
315 Views
It can be checked if a particular LocalTime is before the other LocalTime in a timeline using the isBefore() method in the LocalTime class in Java. This method requires a single parameter i.e. the LocalTime object that is to be compared. It returns true if the LocalTime object is before the other LocalTime object and false otherwise.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalTime lt1 = LocalTime.parse("11:37:12"); LocalTime lt2 = LocalTime.parse("23:15:30"); System.out.println("The LocalTime lt1 is: " ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
274 Views
It can be checked if a particular LocalTime is after the other LocalTime in a timeline using the isAfter() method in the LocalTime class in Java. This method requires a single parameter i.e. the LocalTime object that is to be compared. It returns true if the LocalTime object is after the other LocalTime object and false otherwise.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalTime lt1 = LocalTime.parse("11:37:12"); LocalTime lt2 = LocalTime.parse("23:15:30"); System.out.println("The LocalTime lt1 is: " ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
100 Views
The value of the specified field from the LocalTime can be obtained using the get() method in the LocalTime class in Java. This method requires a single parameter i.e. ChronoField that is required and it returns the value of the specified field from the LocalTime.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; import java.time.temporal.ChronoField; public class Main{ public static void main(String[] args){ LocalTime lt = LocalTime.parse("23:15:30"); System.out.println("The LocalTime is: " + lt); System.out.println("The MINUTE_OF_HOUR is: " + lt.get(ChronoField.MINUTE_OF_HOUR)); } }outputThe LocalTime is: 23:15:30 ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
134 Views
The minute of the hour for a particular LocalTime can be obtained using the getMinute() method in the LocalTime class in Java. This method requires no parameters and it returns the minute of the hour in the range of 0 to 59.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { LocalTime lt = LocalTime.parse("23:15:30"); System.out.println("The LocalTime is: " + lt); System.out.println("The minute is: " + lt.getMinute()); } }outputThe LocalTime is: 23:15:30 The minute is: 15Now let us ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
80 Views
To set a new value in the Decade Tuple, you need to use the setAtX() method. Here, X is the index wherein you want to set the value. For example, setAt2() sets the value at index 2. The value to be included is to be set as the value in the parameter, likesetAt2(“Amit”);Let us first see what we need to work with JavaTuples. To work with Decade class in JavaTuples, you need to import the following packageimport org.javatuples.Decade;Note Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
70 Views
To fetch the value from Decade Tuple in Java, use the getAtX() method. Here, X represents the index value like getAt1() at index 1. This will return the element at index 1 in the Tuple.Let us first see what we need to work with JavaTuples. To work with Decade class in JavaTuples, you need to import the following packageimport org.javatuples.Decade;Note Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
84 Views
To get the number of elements in the queue, use the size() method of the ArrayBlockingQueue class.The syntax is as followsint size()To work with ArrayBlockingQueue class, you need to import the following packageimport java.util.concurrent.ArrayBlockingQueue;The following is an example to implement size() method of Java ArrayBlockingQueue classExample Live Demoimport java.util.concurrent.ArrayBlockingQueue; public class Demo { public static void main(String[] args) throws InterruptedException { ArrayBlockingQueue q = new ArrayBlockingQueue(10); q.add(200); q.add(310); q.add(400); ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
240 Views
The indexOf() method of the CopyOnWriteArrayList class is used to get the index of the first occurrence of an element. The method has two two forms. Let us see them one by oneindexOf(Object o) methodThe indexOf(Object o) is used to get the index of the first occurrence of an element.The syntax is as followsindexOf(Object o)Here, o is the element for which you want the index. To work with CopyOnWriteArrayList class, you need to import the following packageimport java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class indexOf() method in JavaExample Live Demoimport java.util.concurrent.CopyOnWriteArrayList; public class Demo { public static void ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
57 Views
The difference between toArray() and toArray(T[] arr) of the CopyOnWriteArrayList class is that both the methods returns an array containing all of the elements in this collection, but the latter has some additional features i.e. the runtime type of the returned array is that of the specified array.The syntax is as followspublic T[] toArray(T[] arr)Here, the parameter arr is the array into which the elements of the list are to be stored.To work with CopyOnWriteArrayList class, you need to import the following packageimport java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class toArray() method in JavaExample Live Demoimport java.util.Arrays; import ... Read More