Found 34469 Articles for Programming

What are the bitwise zero fill right shift zero operators in Java?

Debarpito Sarkar
Updated on 05-Sep-2022 09:15:05

3K+ Views

This article will help you understand all about Bitwise Zero Fill Right Shift Zero Operators in Java. Note that Bitwise Zero Fill Right Shift Zero Operator is same as Bitwise Zero Fill Right Shift Operator. Before understanding right shift operators, let us revise about Operators. OPERATORS In computer programming we often need to perform some arithmetical or logical operations. In such circumstances, we need operators to perform these tasks. Thus, an Operator is basically a symbol or token, which performs arithmetical or logical operations and gives us meaningful result. The values involved in the operation are called Operands. In this ... Read More

What does the method hashCode(int[] a) do in java?

Samual Sam
Updated on 20-Feb-2020 12:31:32

78 Views

The hashCode(int[]) method of the java.util.Arrays class returns a hash code based on the contents of the specified array. For any two non-null int arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).Exampleimport java.util.Arrays; public class ArrayDemo {    public static void main(String[] args) {       int[] ival = new int[] { 3, 5 };       int retval = ival.hashCode();       System.out.println("The hash code of value1 is: " + retval);       ival = new int[] { 19, 75 };       retval = ival.hashCode(); ... Read More

What does the method hashCode(obj[] a) do in java?

Sai Subramanyam
Updated on 30-Jul-2019 22:30:21

87 Views

The hashCode(Object[]) method of the java.util.Arrays class returns a hash code based on the contents of the specified array. If the array contains other arrays of elements, the hash code is based on their identities rather than their contents. For any two arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b). Example import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { Object[] ob = new Object[] { 22, 7 }; ... Read More

What does the method remove(obj o) do in java?

Sravani S
Updated on 20-Feb-2020 12:14:54

77 Views

The remove(Object) method of the class java.util.ArrayList removes the first occurrence of the specified element from this list, if it is present. If the list does not contain the element, it is unchanged.Exampleimport java.util.ArrayList; public class ArrayListDemo {    public static void main(String[] args) {       ArrayList arrlist = new ArrayList(5);       arrlist.add("G");       arrlist.add("E");       arrlist.add("F");       arrlist.add("M");       arrlist.add("E");       System.out.println("Size of list: " + arrlist.size());       for (String value : arrlist) {          System.out.println("Value = " + ... Read More

What does the method addAll(int, Coll C) do in java?

Ramu Prasad
Updated on 20-Feb-2020 11:30:57

63 Views

The addAll(int index, Collection

What does the method addAll(Coll C)do in java?

V Jyothi
Updated on 20-Feb-2020 11:30:01

82 Views

The addAll(Collection

How to match at the beginning of string in python using Regular Expression?

Pranav Indukuri
Updated on 08-Nov-2022 10:56:52

10K+ Views

A regular expression in Python is a group of characters that allows you to use a search pattern to find a string or set of strings. RegEx is a term for regular expressions. To work with regular expressions in Python, utilise the re package. To match with the beginning of the string in python by using regular expression, we use ^/w+ regular expression. Here, ^ implies the start with. /w returns a match where the string contains any word characters (a z, A Z, 0 9, and underscore character). + indicates one or more occurrence of a character. ... Read More

How to use isAlive() method of Thread class in Java?

Sharon Christine
Updated on 20-Feb-2020 10:00:55

253 Views

The isAlive() method of the Thread class returns true if the thread is alive, which is anytime after the thread has been started but before it runs to completion.Exampleclass first implements Runnable {    public void run() {       try {          for(int i=0; i

Where and how can I create a private constructor in Java?

Swarali Sree
Updated on 25-Feb-2020 10:17:06

243 Views

We can use a private contractor in a Java while creating a singleton class. The Singleton's purpose is to control object creation, limiting the number of objects to only one. Since there is only one Singleton instance, any instance fields of a Singleton will occur only once per class, just like static fields. Singletons often control access to resources, such as database connections or sockets.ExampleThe easiest implementation consists of a private constructor and a field to hold its result, and a static accessor method with a name like getInstance().The private field can be assigned from within a static initializer block ... Read More

When a thread is created and started, what is its initial state?

Samual Sam
Updated on 30-Jul-2019 22:30:20

394 Views

When a new thread begins its life cycle in the new state. It remains in this state until the program starts the thread. It is also referred to as a born thread.After this newly born thread is started, the thread becomes runnable. A thread in this state is considered to be executing its task.

Advertisements