Java String equals() method example.

Moumita
Published on 12-Feb-2018 10:30:23
The equals() method of the String class accepts a String as a parameter and it compares the current string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this ... Read More

Java Program to check whether two Strings are an anagram or not.

Anjana
Published on 12-Feb-2018 10:27:18
According to wiki “An anagram is word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.”To compare whether two strings are anagrams check if their lengths are equal? If so, convert these two strings into character arrays then, ... Read More

How to convert int to String in java?

Manikanth Mani
Published on 12-Feb-2018 10:17:35
You can convert a String value to an integer either using the valueOf() method of the String class or using the toString() method of the Integer class.

What does the >> operator do in Python?

Pythonista
Published on 12-Feb-2018 09:53:14
It is a bitwise right shift operator. The bit pattern is shifted towards right by number of places stipulated by operand on right. Bits on left are set to 0For example a=60 (00111100 in binary), a>>2 will result in 15 (00001111 in binary)>>> a=60 >>> bin(a)result #39;0b111100' >>> b=a>>2 >>> ... Read More

What is function of ^ operator in Python

Pythonista
Published on 12-Feb-2018 09:47:59
In Python, ^ is called EXOR operator. It is a bitwise operator which takes bits as operands. It returns 1 if one operand is 1 and other is 0.Assuming a=60 (00111100 in binary) and b=13 (00001101 in binary) bitwise XOR of a and b returns 49 (00110001 in binary)>>> a=60 ... Read More

Explain function of % operator in Python.

Pythonista
Published on 12-Feb-2018 09:36:17
In Python % is an arithmetic operator that returns remainder of division operation. It is called modulo or remainder operator and operates upon numeric operands except complex numbers>>> a=10 >>> a%3 1 >>> a%5 0 >>> b=12.5 >>> b%2.5 0.0 >>> b%2 0.5Read More

What is behavior of ++ and -- operators in Python?

Pythonista
Published on 12-Feb-2018 09:30:29
In C/C++ and Java etc, ++ and -- operators are defined as increment and decrement operators. In Python they are not defined as operators.In Python objects are stored in memory. Variables are just the labels. Numeric objects are immutable. Hence they can't be incremented or decremented.However, prefix ++ or -- ... Read More

What is operation of <> in Python?

Pythonista
Published on 12-Feb-2018 09:22:52
The <> operator is available in Python 2.x as not equal to operator. there is also != operator for the same operation. In Python 3.x, <> operator is deprecated.Python 2.7>>> a=5                                       ... Read More

What are different Identity operators types in Python?

Pythonic
Published on 12-Feb-2018 00:20:38
Each Python object is assigned a unique identification number when it is stored in memory. It can be fetched by id() function. The is operator compares id() of two objects and returns True if both objects have same value otherwise it returns false. The is not operator on the other ... Read More

What are different assignment operators types in Python?

Pythonic
Published on 12-Feb-2018 00:12:11
Following table shows all assignment operators − Operator Description Example = Assigns values from right side operands to left side operand c = a + b value of a + b into c += It adds right operand to the left operand and ... Read More
Advertisements