Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Object Oriented Programming Articles
Page 197 of 589
Difference between ArrayBlockingQueue and ArrayDeque
ArrayBlockingQueue and ArrayDeque are both array-based collection classes in Java, but they serve different purposes. ArrayBlockingQueue is a thread-safe, bounded FIFO queue designed for producer-consumer scenarios, while ArrayDeque is a fast, resizable double-ended queue for single-threaded use. ArrayBlockingQueue ArrayBlockingQueue implements the BlockingQueue interface. It stores elements in FIFO (First-In-First-Out) order − insertion always happens at the tail and removal at the head. It is thread-safe and bounded: once created with a fixed capacity, the size cannot change. If the queue is full, the inserting thread blocks until space becomes available. ArrayDeque ArrayDeque implements the Deque (double-ended ...
Read MoreDifference between OpenId and OAuth
OAuth and OpenID are both protocols used in web authentication and authorization, but they serve different purposes. OAuth is designed for authorization (granting access to resources without sharing passwords), while OpenID is designed for authentication (verifying who a user is). OAuth OAuth (Open Authorization) is an HTTP-based protocol that allows a third-party application to access a user's resources without the user sharing their password. Instead, OAuth provides an access token that the application uses to interact with APIs on behalf of the user. For example, when a mobile app asks to access your Google Drive files, it uses ...
Read MoreDifference between Java and C language
Both Java and C are among the most popular programming languages in the world. Java is an object-oriented, platform-independent language, while C is a procedural, platform-dependent language. Despite their differences, both have been widely influential in shaping modern software development. Key Differences Feature Java C Developed By James Gosling (1995) Dennis M. Ritchie (1969–1973) Paradigm Object-Oriented (high-level) Procedural (middle-level) Compilation Source → bytecode → JVM interprets/JIT compiles Source → machine code (compiled directly) Functional Unit Objects and classes Functions Inheritance Supported Not supported Threading ...
Read MoreDifference between Traditional Collections and Concurrent Collections in java
In Java, Collections are fundamental data structures that store and manipulate groups of objects efficiently. However, traditional collections like ArrayList and HashMap are not designed for multi-threaded environments. To overcome this, Java 5 introduced Concurrent Collections in the java.util.concurrent package, providing thread-safe alternatives with better performance. Traditional Collections Traditional collections (from java.util) include classes like ArrayList, LinkedList, HashMap, and HashSet. They are not synchronized by default. While synchronized wrappers and legacy classes like Vector and Stack exist, they lock the entire collection, causing performance bottlenecks in multi-threaded scenarios. Concurrent Collections Concurrent collections (from java.util.concurrent) were introduced ...
Read MoreDifferences between Difference between getc(), getchar(), getch() and getche() functions
All of these functions are used to read a character from input and each returns an integer value. They differ in where they read from, whether they use a buffer, and whether they echo the character to the screen. getc() getc() reads a single character from any input stream (file, stdin, etc.). It uses a buffer and waits for the Enter key. Returns EOF on failure. Syntax − int getc(FILE *stream); getchar() getchar() reads a single character from standard input only. It is equivalent to calling getc(stdin). It uses a buffer and ...
Read MoreDifferences between Interface and class in Java
In Java, both classes and interfaces are fundamental building blocks of object-oriented programming. A class provides a complete blueprint for objects, while an interface defines a contract of behaviors that implementing classes must follow. Class A class is a blueprint from which individual objects are created. A class can contain the following variable types − Local Variables − Defined inside methods, constructors, or blocks. They are created when the method is called and destroyed when it completes. Instance Variables − Declared within a class but outside any method. They are initialized when the class is instantiated ...
Read MoreDifference between Application context and Beanfactory in Spring framework
The Spring framework provides two IoC (Inversion of Control) containers for managing, configuring, and manipulating beans − BeanFactory and ApplicationContext. The ApplicationContext interface extends BeanFactory to provide additional enterprise-level functionality. In modern Spring versions, ApplicationContext has largely replaced BeanFactory, though BeanFactory still exists for backward compatibility. Since Spring 2.0 and above, the BeanPostProcessor extension point is used extensively. If you use BeanFactory directly, some features such as AOP proxying and transaction management will not work without extra manual configuration. BeanFactory BeanFactory is the simplest IoC container. It uses lazy loading − beans are created only when ...
Read MoreDifference between lazy and eager loading in Hibernate
Lazy and Eager are two data loading strategies used in ORM frameworks such as Hibernate and EclipseLink. These strategies determine when related entities are fetched from the database − for example, when an Employee entity has a reference to a collection of Phone entities. Lazy Loading Lazy Loading means associated data is loaded only when you explicitly access it (by calling a getter or size method). Until that point, the related data is not fetched from the database. Use Lazy Loading when − You are working with one-to-many or many-to-many collections. You are not always ...
Read MoreHandling Exception and use of CX_ROOT directly and subclasses
It is not advisable to use CX_ROOT directly and you would require using one of its direct subclasses. The CX_ROOT is the root class for all exception classes in SAP ABAP, but working with its subclasses provides better control and handling mechanisms. Also, the propagation depends upon the exception subclass hierarchy. Exception Subclass Types There are three main types of exception subclasses, each with different propagation and handling behaviors − Subclasses ...
Read MoreWhat is constructor chaining in Java?
Constructors are similar to methods but, They do not have any return type. The name of the constructor is same as the name of the class. Every class has a constructor. If we do not explicitly write a constructor for a class, the Java compiler builds a default constructor for that class. Each time a new object is created, at least one constructor will be invoked. A class can have more than one constructor. this() and super() are used to call constructors explicitly. Where, using this() you can call the current class’s constructor and using super() you can ...
Read More