
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9150 Articles for Object Oriented Programming

11K+ Views
DecodingIn JavaScript, to decode a string unescape() method is used. This method takes a string, which is encoded by escape() method, and decodes it. The hexadecimal characters in a string will be replaced by the actual characters they represent using unescape() method.Syntaxunescape(string)ExampleIn the following the two exclamation marks have converted to hexadecimal characters using escape() method. Later on those marks were decoded in to their natural characters using unescape() method. Live Demo // Special character encoded with escape function var str = escape("Tutorialspoint!!"); document.write(""); document.write("Encoded : " + str); // unescape() function document.write("Decoded ... Read More

340 Views
Removing non-word charactersTo remove non-word characters we need to use regular expressions. The logic behind removing non-word characters is that just replace the non-word characters with nothing('').ExampleIn the following example there are many non-word characters and in between them there exists a text named "Tutorix is the best e-learning platform". So using regular expressions the non-word characters were replaced with nothing('') so as to get the word characters as the output.Live Demo function remNonWord (string) { if ((string===null) || (string==='')) return false; else string = ... Read More

1K+ Views
An anonymous inner class is an inner class which is declared without any class name at all. In other words, a nameless inner class is called an anonymous inner class. Since it does not have a name, it cannot have a constructor because we know that a constructor name is the same as the class name.We can define an anonymous inner class and create its object using the new operator at the same time in one step.Syntaxnew(argument-list){ // Anonymous class body }Types of Anonymous Inner Class in JavaAnonymous inner class that extends a classAnonymous inner class that implements an interfaceAnonymous inner ... Read More

172 Views
weakSet.has()This is an inbuilt function in javascript which is used to return a boolean value on scrutinizing whether an object is present in weakSet or not. The weakSet object lets you store weakly held objects in a collection.SyntaxweakSet.has(obj);ArgumentsFrom the above line of code, weakSet.has() accepts a parameter 'obj' and checks whether the parameter is present in the provided weakSet or not.Returning valueBased on presence of value, whether it is in weakSet or not, the weakSet.has() method returns a boolean output. If the value is present then true will be returned else false will be returned.Example-1In the following example weakSet.has() checks whether the object(user provided) 'object1' is ... Read More

1K+ Views
Hiding an e-mail addressThe following steps are to be followed to hide our e-mail from unauthorized users. In every email address '@' symbol is common so try to remove it from the email address using split() method. In the following example after splitting the email(batman@gmail.com) we get the result as batman, gmail.com.Divide the result in to 2 parts(split1 and split2). Using substring() method remove some of string from split1 and join resulted part with split2 using '...@'. Return the joined part as the final output. In our example the resulted output is "bat...@gmail.com".ExampleLive Demo newEmail = function (email) { ... Read More

5K+ Views
The import statement is used to bring certain classes and interfaces from other packages into our Java program, so we can access them without using their fully qualified names. We can use the short name instead. Java also supports static import statements, which were introduced in Java 5. It helps in accessing static members such as methods and constants. In this article, we are going to learn the difference between import and static import statements in Java. The import Statement in Java To access a class or method from another package, we need to either use the fully qualified ... Read More

1K+ Views
Accessing a function as a method A javascript object is made up of properties. To access a property as a method, just define a function to a property and include other properties in that function.In the following example an object called "employee" is created with properties "fullName", "lastName" , "firstName" and "id". A function is defined under property "fullName" and properties such as "firstName" and "lastName" were included in it. So when the property "fullName" is called, the full name of the employee is going to display as shown in the output.Example-1Live Demo var employee = { ... Read More

9K+ Views
The compareTo() and compare() methods are both used to compare two objects. They return an int value after comparison, which tells if both objects are equal, if not, which is lesser, and which is greater. The primary difference between these two methods is that the compareTo() method is used when the Comparable interface is implemented, whereas the compare() method is used when the Comparator interface is implemented. Let's understand the use of compareTo() and compare() methods in Java, and then we will discuss how these two methods are different from each other. The compareTo() Method in Java The compareTo() method compares the ... Read More

11K+ Views
In javascript , we can add a number and a number but if we try to add a number and a string then, as addition is not possible, 'concatenation' takes place.In the following example, variables a, b, c and d are taken. For variable 'a', two numbers(5, 5) are added therefore it returned a number(10). But in case of variable 'b' a string and a number ('5', 5) are added therefore, since a string is involved, we get the result as '55', which is a string. since strings are involved, Variables 'c' and 'd' also return a string as shown in the ... Read More

3K+ Views
No, we cannot write any statements in between try, catch and finally blocks and these blocks form one unit. The functionality of try keyword is to identify an exception object and catch that exception object and transfer the control along with the identified exception object to the catch block by suspending the execution of the try block. The functionality of the catch block is to receive the exception class object that has been sent by the try and catch that exception class object and assigns that exception class object to the reference of the corresponding exception class defined in the catch block. The finally blocks are ... Read More