
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

1K+ Views
The "this" keyword in Java is used as a reference to the current object, within an instance method or a constructor. Using it, you can refer the members of a class such as constructors, variables, and methods.Assigning reference to "this"According to the definition "this" is a keyword which acts as a reference to the current object (the object from whose constructor/method you are using it), its value id is fixed. Therefore, you cannot assign a new reference value to it. Moreover, it is just a keyword, not a variable.Still, if you try to it assign a reference value to "this" it ... Read More

6K+ Views
In this article, we will learn about the basic structure of a program in Java. Java is widely used for developing large-scale applications, including Android apps, web applications, and enterprise software. To write a Java program, it's essential to understand its basic structure, which consists of several key components. Components A typical structure of a Java program contains the following elements: Package declaration Import statements Comments Class definition Class variables, Local variables Methods/Behaviors ... Read More

2K+ Views
Using Css style we can hide or show HTML elements in javascript. Css provides properties such as block and none to hide/show the HTML elements.Hiding an elementExampleIn the following example when the "Hideme" button has clicked the text in the paragraph tag has been disappeared as shown in the output.Live Demo Using JavaScript to hide HTML elements.

3K+ Views
In Java, non-static blocks run before the constructor whenever an object is created. If multiple non-static blocks exist, they execute in the order they appear in the class, followed by the constructor. In this article, we will understand this order of execution with the help of examples. What Are Non-Static Blocks in Java? The Non-static blocks are class-level blocks which don't contain a prototype. A non-static block must perform any logic whenever an object is instantiated, regardless of the constructor. The Non-static blocks are automatically called by the JVM for every object creation in the Java stack area. We can ... Read More

235 Views
The substring() method returns a String datatype which corresponds to the original String starting from the begin index until the end Index. If the end index is not specified, it is imperative that the endIndex is the String length. Since we are dealing with the String, the index starts at '0' position.Syntaxpublic String substring(int beginIndex) public String substring(int beginIndex, int endIndex)beginIndex: the starting index or position where we want to start to cut or substring our String.endIndex: the end index or position where we want to end our cutting or substring our String.This method returns a String datatype which corresponds to the ... Read More

1K+ Views
The UncaughtExceptionHandler is an interface inside a Thread class. When the main thread is about to terminate due to an uncaught exception the java virtual machine will invoke the thread’s UncaughtExceptionHandler for a chance to perform some error handling like logging the exception to a file or uploading the log to the server before it gets killed. We can set a Default Exception Handler which will be called for the all unhandled exceptions. It is introduced in Java 5 Version.This Handler can be set by using the below static method of java.lang.Thread class.public static void setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler ueh)We have to provide an implementation of the interface ... Read More

1K+ Views
A Java program can execute in the Java Virtual Machine (JVM) and uses the heap memory to manage the data. If our Java program requires more memory, there is a possibility that the Java Virtual Machine(JVM) will begin to throw OutOfMemoryError instances when attempting to instantiate an object in Java. How to change/increase the JVM Heap Size? In Java, it is possible to increase the heap size allocated by the JVM: -Xms: Set an initial Java heap size JVM automatically manages the heap memory but we can ... Read More

1K+ Views
Removing duplicatesTo remove duplicates in an array we have many logical methods, but advanced javascript has provided some methods so that the task of removing duplicates has become very simple. Some of those methods are set() and filter(). For better understanding lets' discuss each method individually.Set()The important use of the set() method is that it only allows unique values. In other words, it will automatically remove duplicates and makes the task easy for us. The Set() method won't take any logical approach in removing duplicates.Example In the following example, the duplicates in the provided array have been removed without any ... Read More

6K+ Views
To convert a string in to function "eval()" method should be used. This method takes a string as a parameter and converts it into a function.syntaxeval(string);ExampleIn the following example, in a string itself, a property called 'age' is assigned with a function. Later on, using eval() function the property age is converted into a function and displayed as shown in the output. Live Demo var string = '{"name":"Ram", "age":"function() {return 27;}", "city":"New jersey"}'; var fun = JSON.parse(string); fun.age = eval("(" + fun.age + ")"); document.write(fun.name + " "+ "of Age" + " "+ fun.age()+ " " + "from ... Read More

3K+ Views
In 5.4 PHP version trait is introduced to PHP object-oriented programming. A trait is like class however it is only for grouping methods in a fine-grained and reliable way. It isn't permitted to instantiate a trait on its own. Traits are introduced to PHP 5.4 to overcome the problems of single inheritance. As we know in single inheritance class can only inherit from one other single class. In the case of trait, it enables a developer to reuse sets of methods freely in several independent classes living in different class hierarchies. Example Output Result of addition two numbers:8 ... Read More