
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

544 Views
It does't matter how many lines of code you write in a program. When you want to remove or delete any elements from the Python list, you have to think about the difference between remove, del and pop in Python List and which one to useremove : remove() removes the first matching value or object, not a specific indexing. lets say list.remove(value)Examplelist=[10, 20, 30, 40] list.remove(30) print(list)Output[10, 20, 40]del : del removes the item at a specific index. lets say del list[index]Examplelist = [10, 20, 30, 40, 55] del list[1] print(list)Output[10, 30, 40, 55]pop : pop removes the item at a specific index and returns ... Read More

13K+ Views
Python uses a mechanism, which is known as "Call-by-Object", sometimes also called "Call by Object Reference" or "Call by Sharing"If you pass immutable arguments like integers, strings or tuples to a function, the passing acts like Call-by-value. It's different, if we pass mutable arguments.All parameters (arguments) in the Python language are passed by reference. It means if you change what a parameter refers to within a function, the change also reflects back in the calling function.Examplestudent={'Archana':28, 'krishna':25, 'Ramesh':32, 'vineeth':25} def test(student): new={'alok':30, 'Nevadan':28} student.update(new) print("Inside the function", student) return test(student) print("outside the function:", student)OutputInside the function ... Read More

195 Views
Atomics.store()Atomics.store() is an inbuilt method that is used to store a specific value at a specific position in an array. This method accepts an Integer typed array, index and the value as arguments.SyntaxAtomics.store(typedArray, index, value);Parameterstyped array - it the shared integer typed array that we need to modify.index - It is the position in the array where we are going to store the value.value - it is number we want to store.Whenever we want to store a value at a specific place and wants to return the stored value then Atomics.store() is used.One should note that Atomics are used with SharedArrayBuffer(generic fixed-length binary ... Read More

4K+ Views
In Java, both the length property and the length() method are used to determine the size of data, or we can say they help us to find the number of elements an object contains. However, they are used with different Java objects. The length is an instance variable used for arrays, whereas length() is a method used with String objects. In this article, we are going to discuss the difference between length and length() in Java. The length Property An array is an object that holds a fixed number of values of the same type. Its length variable is used to find the number ... Read More

3K+ Views
We can remove non-alphanumeric characters from the string with preg_replace() function in PHP. The preg_replace() function is an inbuilt function in PHP which is used to perform a regular expression for search and replace the content.syntaxpreg_replace(pattern, replacement, subject, limit, count )Let's discuss the parameters of the function underneath.patternThis parameter contains the pattern to search for.replacementIt is a mandatory parameter. This parameter may contain a string or an array with strings to replace.subjectThe string or an array with strings to search and replace.limitThe maximum possible replacements for each pattern in each subject stringcountThis is an optional parameter, if specified then this ... Read More

10K+ Views
Yes, we can declare a try-catch block within another try-catch block in Java, this is called nested try-catch block. The try-catch block is used to handle runtime errors that occur during the execution of a program, and the process of handling these errors is called exception handling. The runtime errors or exceptions must be handled in order to maintain the normal flow ofaJava program. Try-Catch Block in Java In a try-catch block, the code that might throw an exception should be placed or written within a try block. The catch block is used to handle the exception that is thrown from ... Read More

8K+ Views
No, we cannot declare a top-level class as private or protected. It can be either public or default (no modifier). If it does not have a modifier, it is supposed to have a default access.Syntax// A top level class public class TopLevelClassTest { // Class body }If a top-level class is declared as private the compiler will complain that the modifier private is not allowed here. This means that a top-level class cannot be a private, the same can be applied to protected access specifier also.Protected means that the member can be accessed by any class in the same ... Read More

830 Views
Yes, we can access the local final variables using the method local inner class because the final variables are stored on the heap and live as long as the method local inner class object may live.Method Local Inner ClassA local inner class instance can be delivered as an argument and retrieved from the methods and it is available inside a valid scope.The only limitation in method local inner class is that a local parameter can be executed only when it is defined as final.The method executing the local parameters can be called after the execution of the method, within which the local inner ... Read More

326 Views
In Java, ArrayStoreException is a public class that extends the RuntimeException class of the java.lang package. It is thrown by the Java Virtual Machine when a runtime error occurs. Since it is an unchecked exception, it does not require an explicit declaration in a method or a constructor's throws clause. Let's understand why the ArrayStoreException is thrown and how we can avoid it. Reason for ArrayStoreException in Java As mentioned earlier, ArrayStoreException is an unchecked exception, and it can occur when we try to store an object of one type in an array of a different type. Usually, one would ... Read More

4K+ Views
Yes, Python supports multiple inheritance. Like C++, a class can be derived from more than one base classes in Python. This is called Multiple Inheritance. In multiple inheritance, the features of all the base classes are inherited into the derived class. Let us see the syntax − Syntax Class Base1: Body of the class Class Base2: Body of the class Class Base3: Body of the class . . . Class BaseN: Body of the class Class Derived(Base1, Base2, Base3, … , BaseN): Body of the class The Derived class inherits from both Base1, Base2 and Base3classes. ... Read More