Nancy Den has Published 335 Articles

Rotate elements of a collection in Java

Nancy Den

Nancy Den

Updated on 25-Jun-2020 13:19:58

274 Views

To rotate elements of a collection in Java, we use the Collections.rotate() method. The rotate method rotates the elements specified in the list by a specified distance. When this method is invoked, the element at index x will be the element previously at index (x - distance) mod list.size(), for ... Read More

Create integer array with Array.newInstance in Java

Nancy Den

Nancy Den

Updated on 25-Jun-2020 13:13:53

130 Views

The java.lang.reflect.Array.newInstance(Class componentType, int length) method forms a new array with the component type and length as specified in the argumentsDeclaration − The java.lang.reflect.Array.newInstance(Class componentType, int length) method is declared as follows -public static Object newInstance(Class componentType, int length) throws IllegalArgumentException, NegativeArraySizeExceptionLet us see a program to create an integer ... Read More

Compare two float arrays in a single line in Java

Nancy Den

Nancy Den

Updated on 25-Jun-2020 12:29:39

133 Views

Two float arrays can be compared in Java using the java.util.Arrays.equals() method. This method returns true if the arrays are equal and false otherwise. The two arrays are equal if they contain the same number of elements in the same order.A program that compares two float arrays using the Arrays.equals() ... Read More

Check whether String is an interface or class in Java

Nancy Den

Nancy Den

Updated on 25-Jun-2020 12:27:18

433 Views

The method java.lang.Class.isInterface() is used to find if String is an interface or class in Java. This method returns true if String is an interface, otherwise it returns false.A program that demonstrates this is given as follows −Example Live Demopackage Test; import java.lang.*; public class Demo {    public static void ... Read More

Load class with forName() method in Java

Nancy Den

Nancy Den

Updated on 25-Jun-2020 12:24:16

2K+ Views

The class object associated with the class with the given string name can be returned with the method java.lang.Class.forName(String name, boolean initialize, ClassLoader loader), using the class loader that is used to load the class.The parameters in the forName() method are name, initialize and loader. If the value of the ... Read More

Display the declared methods of java.lang.Math

Nancy Den

Nancy Den

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

57 Views

The methods of the java.lang.Math class can be listed using the java.lang.Class.getDeclaredMethods() method. This method returns an array that contains all the Method objects with public, private, protected and default access. However, the inherited methods are not included. Also, the getDeclaredMethods() method returns a zero length array if the class or ... Read More

How to play HTML

Nancy Den

Nancy Den

Updated on 25-Jun-2020 07:48:32

42 Views

To play HTML blocks one by one, use the following HTML first −         The following is what you need to do to play audio one by one −var one = document.getElementById('one'); one.onended = function() {    document.getElementById('two').play(); } one.play();

Playing a WAV file on iOS Safari

Nancy Den

Nancy Den

Updated on 25-Jun-2020 07:13:31

330 Views

To play a WAV file on iOS Safari, add a content-range header.The headers would allow a WAV file to play −Content-Range: bytes XX-XX/XX Content-Type: audio/wav Content-Disposition: attachment; filename = "new.WAV" Content-Length: XXAbove, new.WAV is our WAV file.

How to avoid repeat reloading of HTML video on the same page?

Nancy Den

Nancy Den

Updated on 25-Jun-2020 06:34:54

647 Views

Use preload = ”auto” to avoid repeat reloading of HTML video on the same page −                                        Your browser does not support the video tag.          

How to track pages in a single page application with Google Analytics?

Nancy Den

Nancy Den

Updated on 25-Jun-2020 06:26:49

185 Views

A Single Page Application (SPA) loads the resources required to navigate throughout the site. This is for the first page load and SPA is a web application or website.The content loads dynamically when your site’s link is clicked and the user interacts with the page. On load, the data stored ... Read More

Previous 1 ... 3 4 5 6 7 ... 34 Next
Advertisements