Articles on Trending Technologies

Technical articles with clear explanations and examples

IntStream rangeClosed() method in Java

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 1K+ Views

The rangeClosed() class in the IntStream class returns a sequential ordered IntStream from startInclusive to endInclusive by an incremental step of 1. This includes both the startInclusive and endInclusive values.The syntax is as followsstatic IntStream rangeClosed(int startInclusive, int endInclusive)Here, startInclusive is the value including the first value and endInclusive is the value indicating the last value. To work with the IntStream class in Java, import the following packageimport java.util.stream.IntStream;The following is an example to implement IntStream rangeClosed() method in JavaExampleimport java.util.stream.IntStream; public class Demo { public static void main(String[] args) { ...

Read More

DoubleStream mapToObj() method in Java

Smita Kapse
Smita Kapse
Updated on 11-Mar-2026 264 Views

The mapToObj() method of the DoubleStream class returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.The syntax is as follows − Stream mapToObj(DoubleFunction

Read More

Custom len() Function In Python

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 845 Views

Let's see how can we implement custom len() function in Python. Try it by yourself first using the following steps.StepsGet the iterator from the user string/list/tuple.Define a function with a custom name as you like and invoke it by passing the iterator.Initialize the count to 0.Run a loop until it reaches the end.Increment the count by 1Return the count.Example## function to calculate lenght of the iterator def length(iterator):    ## initializing the count to 0    count = 0    ## iterating through the iterator    for item in iterator:       ## incrementing count       count ...

Read More

Initializer for final static field in Java

Rishi Raj
Rishi Raj
Updated on 11-Mar-2026 1K+ Views

The final static field variable is a constant variable. There is only one copy of this variable available. It is mandatory to initialize the final static field variable explicitly as the default value for it is not provided by the JVM. Also, this variable cannot be reinitialized.A program that initializes the final static field variable using a static initialization block is given as follows:Examplepublic class Demo {    final static int num;    static {       System.out.println("Running static initialization block.");       num = 6;    }    public static void main(String[] args) {       ...

Read More

SecureRandom getProvider() method in Java

Samual Sam
Samual Sam
Updated on 11-Mar-2026 145 Views

The provider for the SecureRandom object can be obtained using the method getProvider() in the class java.security.SecureRandom. This method requires no parameters and it returns the provider for the SecureRandom object.A program that demonstrates this is given as follows −Exampleimport java.security.*; import java.util.*; public class Demo {    public static void main(String[] argv) {       try {          SecureRandom sRandom = SecureRandom.getInstance("SHA1PRNG");          Provider provider = sRandom.getProvider();          System.out.println("The Provider is: " + provider.getName());       } catch (NoSuchAlgorithmException e) { ...

Read More

How to return an array whose elements are the enumerable property values of an object in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 11-Mar-2026 290 Views

We can use some logical methods to get the values and also keys from an object, but those methods will not return the values as an array, which is very useful in many cases. Javascript has provided Object.values() method to get an array whose elements are the enumerable property values of an object.syntaxObject.values(obj);This method takes an object as an argument and returns an array whose elements are nothing but the property values of the object.Example-1In the following example, an object is sent through the method object.values() and the property values were displayed as an array.    var obj = {"one":1, ...

Read More

How to declaring pointer variables in C/C++?

Anvi Jain
Anvi Jain
Updated on 11-Mar-2026 535 Views

A pointer is used to store the address of the variables. To declare pointer variables in C/C++, an asterisk (*) used before its name.Declaration*pointer_nameIn CExample#include int main() {    // A normal integer variable    int a = 7;    // A pointer variable that holds address of a.    int *p = &a;    // Value stored is value of variable "a"    printf("Value of Variable : %d", *p);    //it will print the address of the variable "a"    printf("Address of Variable : %p", p);    // reassign the value.    *p = 6;    printf("Value of ...

Read More

SecureRandom setSeed() method in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 500 Views

The random object can be reseeded using the setSeed() method in the class java.security.SecureRandom. This method requires a single parameter i.e. the required seed byte array and it returns the reseeded random object.A program that demonstrates this is given as follows −Exampleimport java.security.*; import java.util.*; public class Demo {    public static void main(String[] argv) {       try {          SecureRandom sRandom = SecureRandom.getInstance("SHA1PRNG");          String str = "Apple";          byte[] arrB = str.getBytes();          sRandom.setSeed(arrB);          byte[] arrSeed = sRandom.getSeed(5);     ...

Read More

The equals() method of AbstractSequentialList in Java

Smita Kapse
Smita Kapse
Updated on 11-Mar-2026 154 Views

The equals() method is inherited from the AbstractList class in Java. It is used to check the object for equality with this list. It returns TRUE if the object is equal to this list, else FALSE is returned.The syntax is as follows −public boolean equals(Object o)Here, o is the object to be compared for equality with this list.To work with the AbstractSequentialList class in Java, you need to import the following packageimport java.util.AbstractSequentialList;The following is an example to implement AbstractSequentialList equals() method in JavaExampleimport java.util.LinkedList; import java.util.AbstractSequentialList; public class Demo {    public static void main(String[] args) {   ...

Read More

Write the syntax of javascript with a code to demonstrate it?

vineeth.mariserla
vineeth.mariserla
Updated on 11-Mar-2026 260 Views

JavaScript TagsThe html script tag wants the browser to get a script between them. We can expect the scripts to be in the following places. 1.The script can be placed in html's head tag 2.Within Html's body tag. 3.As an external file. Most importantly client side scripts such as JavaScript are placed in script tags.demonstration code  This example writes "JavaScript is not java" into an HTML element with id="script"    document.getElementById("imp").innerHTML = "JavaScript is not java"; OutputThis example writes "JavaScript is not java" into an HTML element with id="script" JavaScript is not javaExplanationEvery JavaScript code should be in the ...

Read More
Showing 8521–8530 of 61,248 articles
« Prev 1 851 852 853 854 855 6125 Next »
Advertisements