Schedule Tasks in Java for Repeated Fixed Delay Execution

Arjun Thakur
Updated on 25-Jun-2020 14:43:41

1K+ Views

One of the methods in the Timer class is the void schedule(TimerTask task, long delay, long period) method. This method schedules tasks for repeated fixed-delay execution, beginning after the specified delay.In fixed-delay execution, each execution is scheduled with respect to the original execution time of the preceding execution. If an execution is delayed for a particular reason (case in point, garbage collection), the subsequent executions will be delayed as well.Declaration −The java.util.Timer.schedule(TimerTask task, long delay, long period) is declared as follows −public void schedule(TimerTask task, long delay, long period)Here, task is the task to be scheduled, delay is the delay ... Read More

Perform Animation on CSS min-height

Chandu yadav
Updated on 25-Jun-2020 14:42:24

322 Views

To implement animation on min-height property with CSS, you can try to run the following codeExampleLive Demo                    div {             overflow: auto;             width: 350px;             background-color: blue;             color: white;             border: 1px solid black;             animation: myanim 3s infinite;          }          @keyframes myanim {             ... Read More

CSS voice-duration Speech Media Property

George John
Updated on 25-Jun-2020 14:41:51

213 Views

The voice-duration property in CSS is used where synchronization of speech is done with other media.The following is an example to implement the voice-duration speech media propertyp {    voice-duration: 5s; }Above you can set auto value also.The auto value rectify a used value corresponding to the duration of the speech synthesis when using the inherited voice-rate. This is when you use inherited voice-rate.

CSS voice-balance Speech Media Property

Ankith Reddy
Updated on 25-Jun-2020 14:41:22

167 Views

Use the voice-balance property to set whether the spoken voice is from the left or right, etc.The following is a syntax to set the volume from left or right or centervoice-balance: left | center | rightLet us see an example to implement the voice-balance speech media propertyp {    voice-balance: right; }

Dump Array Content in Java

Ankith Reddy
Updated on 25-Jun-2020 14:40:53

351 Views

An array can be easily printed by using the method java.util.Arrays.toString() in Java. This method returns a string representation of the array contents that is enclosed in square brackets. If the array is null, then this method returns null.A program that demonstrates this is given as follows −Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String args[]) {       String str[] = {"John", "Harry", "Sally", "Emma", "Peter"};       System.out.println("The array content is:");       System.out.println(Arrays.toString(str));    } }OutputThe array content is: [John, Harry, Sally, Emma, Peter]Now let us understand the above program.The ... Read More

Perform Animation on CSS max-width

Arjun Thakur
Updated on 25-Jun-2020 14:40:38

1K+ Views

To implement animation on max-width property with CSS, you can try to run the following codeExampleLive Demo                    div {             overflow: auto;             background-color: blue;             color: white;             border: 1px solid black;             animation: myanim 3s;          }          @keyframes myanim {             30% {               ... Read More

Linked List in Java

Chandu yadav
Updated on 25-Jun-2020 14:40:33

492 Views

The LinkedList class extends AbstractSequentialList and implements the List interface. It provides a linked-list data structure.Following are the constructors supported by the LinkedList class.Sr.No.Constructor & Description1LinkedList( )This constructor builds an empty linked list.2LinkedList(Collection c)This constructor builds a linked list that is initialized with the elements of the collection c.Apart from the methods inherited from its parent classes, LinkedList defines following methods.Sr.No.Method & Description1void add(int index, Object element)Inserts the specified element at the specified position index in this list. Throws IndexOutOfBoundsException if the specified index is out of range (index < 0 || index > size()).2boolean add(Object o)Appends the specified element ... Read More

Sort Elements in an ArrayList in Java

George John
Updated on 25-Jun-2020 14:40:21

4K+ Views

In order to sort elements in an ArrayList in Java, we use the Collections.sort() method in Java. This method sorts the elements available in the particular list of the Collection class in ascending order.Declaration −The java.util.Collections.sort() method is declared as follows −public static void sort(List list)where list is an object on which sorting needs to be performed.Let us see a program to sort elements in an ArrayList in Java −Example Live Demoimport java.util.*; public class Example {    public static void main (String[] args) {       List zoo = new ArrayList();       zoo.add("Zebra");       zoo.add("Lion"); ... Read More

Copy Elements of ArrayList to Java Vector

Chandu yadav
Updated on 25-Jun-2020 14:39:50

448 Views

In order to copy elements of ArrayList to Java Vector, we use the Collections.copy() method. It is used to copy all elements of a collection into another.Declaration −The java.util.Collections.copy() method is declared as follows −public static void copy(List

Local Inner Class in Java

Arjun Thakur
Updated on 25-Jun-2020 14:38:35

3K+ Views

In Java, just like methods, variables of a class too can have another class as its member. Writing a class within another is allowed in Java. The class written within is called the nested class, and the class that holds the inner class is called the outer class.SyntaxFollowing is the syntax to write a nested class. Here, the class Outer_Demo is the outer class and the class Inner_Demo is the nested class.class Outer_Demo {    class Inner_Demo {    } }Nested classes are divided into two types.Non-static nested classes − These are the non-static members of a class.Static nested classes ... Read More

Advertisements