Chandu yadav has Published 1163 Articles

Get the arc cosine of an angle in Java

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 09:50:18

151 Views

To get the arc cosine of a given value in Java, we use the java.lang.Math.acos() method. The acos() method accepts a double value whose angle needs to be computed. The range of the angle returned lies in the range 0 to pi. If the argument is NaN or greater than ... Read More

Schedule a task for execution in Java

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 09:43:24

5K+ Views

One of the methods in the Timer class is the void schedule(Timertask task, Date time) method. This method schedules the specified task for execution at the specified time. If the time is in the past, it schedules the task for immediate execution.Declaration −The java.util.Timer.schedule(Timertask task, Date time) is declared as ... Read More

Schedule a task for execution in Java after a given delay

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 09:37:39

1K+ Views

One of the methods in the Timer class is the void schedule(Timertask task, long delay) method. This method schedules the specified task for execution after the specified delay.Declaration −The java.util.Timer.schedule(Timertask task, long delay) is declared as follows −public void schedule(Timertask task, long delay)There are few exceptions thrown by the schedule(Timertask ... Read More

Call the run() method of the Timer Task in Java

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 09:31:30

643 Views

The java.util.TimerTask.run() method looks onto the action to be performed by the task. It is used to carry out the action performed by the task.Declaration −The java.util.TimerTask.run() method is declared as follows −public abstract void run()Let us see an example program to call the run() method of the Timer Task ... Read More

Get elapsed time in minutes in Java

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 09:25:07

2K+ Views

To get the elapsed time of an operation in minutes in Java, we use the System.currentTimeMillis() method. The java.lang.System.currentTimeMillis() returns the current time in milliseconds.Declaration −The java.lang.System.currentTimeMillis() is declared as follows −public static long currentTimeMillis()The method returns time difference in milliseconds between the current time and midnight, January 1, 1970 ... Read More

Get all the IDs of the Time Zone in Java

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 09:15:09

5K+ Views

To get all the IDs of the TimeZone in Java, we use the getAvailableIDs() method. The getAvailableIDs() method returns all the available IDs which are compatible.Declaration −The java.util.TimeZone.getAvailableIDs() method is declared as follows −public static String[] getAvailableIDs()Let us see a Java program which gets all the IDs of the Time ... Read More

Get the default Time Zone in Java

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 09:13:13

2K+ Views

In order to get the default Time Zone in Java, we use the getDefault() method. The java.util.TimeZone.getDefault() method returns the default TimeZone for the particular host. The source of the default TimeZone varies with the implementation.Declaration −The java.util.TimeZone.getDefault() method is declared as follows −public static TimeZone getDefault()Let us see a ... Read More

CSS background-origin property

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 08:16:48

114 Views

The CSS background-origin property is used to specify position of the background images.ExampleYou can try to run the following code to implement background-origin property:Live Demo                    #demo {             border: 5px dashed red;       ... Read More

How to format message with integer fillers in Java

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 08:09:10

222 Views

To format message with integer fillers in Java, we use the MessageFormat class. The MessageFormat class gives us a way to produce concatenated messages which are not dependent on the language. The MessageFormat class extends the Serializable and Cloneable interfaces.Declaration − The java.text.MessageFormat class is declared as follows −public class ... Read More

Find frequency of each word in a string in Java

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 07:38:47

1K+ Views

In order to get frequency of each in a string in Java we will take help of hash map collection of Java.First convert string to a character array so that it become easy to access each character of string.Now compare for each character that whether it is present in hash ... Read More

Advertisements