Anjana has Published 53 Articles

Why do we use a plus sign in front of function name in JavaScript?

Anjana

Anjana

Updated on 12-Jun-2020 08:26:41

199 Views

The +function() {} notation is primarily used to force the parser to treat whatever follows the + as an expression. This is used for functions that are invoked immediately, for example, +function() { alert("Demo!"); }();However, + before a function is one of the symbols. You can add other options also ... Read More

What is the role of screenX Mouse Event in JavaScript?

Anjana

Anjana

Updated on 23-May-2020 09:36:05

117 Views

When an event is triggerd, the screenX mouse event returns the horizontal coordinate of the mouse pointer.ExampleYou can try to run the following code to learn how to implement screenX Mouse event in JavaScript.           Click here to get the x (horizontal) and y (vertical) coordinates ... Read More

What is the usage of onhashchange event in JavaScript?

Anjana

Anjana

Updated on 21-May-2020 07:46:11

113 Views

When anchor part is changed, then the onhashchange event occurs. You can try to run the following code to learn how to implement onhashchange event in JavaScript.Example           Click to change anchor                function functionChange() {     ... Read More

What is JavaScript Bitwise NOT(~) Operator?

Anjana

Anjana

Updated on 20-May-2020 09:36:34

154 Views

The Bitwise NOT (~) Operator performs NOT operation on the bits. You can try to run the following code to learn how to work with JavaScript Bitwise NOT Operator.Example                    document.write("Bitwise NOT Operator");          // 7 = 00000000000000000000000000000111          document.write(~7);          

Java String Contains Example.

Anjana

Anjana

Updated on 26-Feb-2020 09:40:10

127 Views

The contains() method of String class returns true if and only if this string contains the specified sequence of char values.ExampleLive Demoimport java.lang.*; public class StringDemo {    public static void main(String[] args) {       String str1 = "tutorials point", str2 = "http://";       CharSequence cs1 = ... Read More

How to remove all whitespace from String in Java?

Anjana

Anjana

Updated on 26-Feb-2020 09:38:45

7K+ Views

The replaceAll() method of the String class replaces each substring of this string that matches the given regular expression with the given replacement. You can remove white spaces from a string by replacing " " with "".ExampleLive Demoimport java.io.*; public class Test {    public static void main(String args[]) {   ... Read More

Write a java program to reverse each word in string?

Anjana

Anjana

Updated on 26-Feb-2020 07:05:44

501 Views

StringBuffer class of the java.lang package provides reverse() method. This method returns a reverse sequence of the characters in the current String. Using this method you can reverse a string in Java.To reverse each word in a string you need to split the string, store it in an array of strings ... Read More

How to check if two strings are equal in Java?

Anjana

Anjana

Updated on 26-Feb-2020 06:39:51

15K+ Views

You can check the equality of two Strings in Java using the equals() method. This method compares this 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 Concatenate String.

Anjana

Anjana

Updated on 26-Feb-2020 05:59:28

235 Views

The concat() method of the String class concatenates the specified string to the end of this string.ExampleLive Demoimport java.lang.*;    public class StringDemo {       public static void main(String[] args) {       // print str1       String str1 = "self";       System.out.println(str1); ... Read More

Concatenate Multiple Strings in Java.

Anjana

Anjana

Updated on 26-Feb-2020 05:43:30

4K+ Views

You can concatenate multiple strings using the ‘+’ operator of Java.Examplepublic class Test {    public static void main(String args[]) {       String st1 = "Hello";       String st2 = "How";       String st3 = "You";       String res = st1+st2+st3;       System.out.println(res);    } }OutputHelloHowYou

Advertisements