Found 9326 Articles for Object Oriented Programming

Reading Text File into Java HashMap

Shriansh Kumar
Updated on 16-May-2023 10:41:30

2K+ Views

HashMap is a class that is used to implement Map Interface. It stores its element in key-value pairs. The Key is an object that is used to fetch and receive value associated with it. It has access to all the methods of Map Interface, it does not have any additional methods of its own. Duplicate values are not allowed, although we can store null values and keys. In this article, we will try reading the content of a local text file into Java HashMap. Java Program to Read Text File into Java HashMap The general syntax for HashMap is as ... Read More

Recursive Constructor Invocation in Java

Shriansh Kumar
Updated on 16-May-2023 10:37:38

945 Views

Recursive Constructor Invocation is a compile time error that occurs when a constructor calls itself. It is similar to recursion where a method calls itself as often as necessary. The method that calls itself is called as recursive method and the constructor that calls itself is called as recursive constructor. In this article, we will understand the Recursive Constructor Invocation error in Java with a few examples. Recursive Constructor Invocation Constructor It is quite similar to methods but the difference is that methods define the behavior of an object but constructor is used to initialize those objects. We can provide ... Read More

Program to print interesting pattern

Shriansh Kumar
Updated on 16-May-2023 12:17:40

293 Views

Solving interesting pattern problems enhances the understanding of loops. They are essential because they help in building a strong foundation of a particular programming language. There are various kinds of patterns including number-based, star-based and alphabetical patterns as well. In this article, we will discuss a few Java programs to print interesting star patterns. Program to Print Interesting Pattern Pattern 1 Approach Declare and initialize an integer ‘n’ that specifies number of rows and columns. Define a for loop that will run till ‘n’. Inside this loop define an if-else block. The if block will print star ‘n’ ... Read More

StAX vs SAX Parser in Java

Shriansh Kumar
Updated on 15-May-2023 17:41:53

2K+ Views

Both StAX and SAX are a type of XML parser APIs. Here, API stands for Application Programming Interface and Parser is used to read and extract content from an XML document in desired format. From this line, it is clear that StAX and SAX are used to read XML documents. APIs are a modern way to migrate real time information on the Web. In this article, we will discuss the difference between StAX and SAX Parser in Java. StAX vs SAX Parser XML Its full form is eXtensible Markup Language and it is said to be a data description language. ... Read More

Similarities between TreeMap and TreeSet in Java

Shriansh Kumar
Updated on 15-May-2023 17:39:43

281 Views

The TreeMap and TreeSet, both are the part of Collection Framework classes. There exist a few differences as well as a few similarities in their implementation and working. The TreeMap maintains key-value pair on the other hand the TreeSet does not have this feature. In this article, we will discuss the similarities between both classes of Collection Interface. Collection Interface In Java, collection is an object or we can say a container for simplicity that allows us to group several numbers of objects in a single unit. The collection interface is present at the root of all collection framework interfaces. ... Read More

Standard Practice for Protecting Sensitive Data in Java

Shriansh Kumar
Updated on 15-May-2023 17:38:14

234 Views

Every time we do surfing on the Web or we download any file from Web, we take a risk of a virus attack. Maybe that file contains some malicious code that can breach the security and gain unauthorized access to system resources. If we are building an application that has users’ sensitive data, for example, a banking system contains confidential data like credit and debit card details, addresses, email and so forth. Then securing those data becomes our foremost priority. In this article, we are going to discuss a few standard practices for protecting the sensitive data of users in ... Read More

Non-blocking Server in Java NIO

Deepti S
Updated on 15-May-2023 17:53:07

653 Views

Non-blocking Server Java NIO (New Input/Output) is a very powerful networking and file-handling application that functions as an alternative to Java's standard IO API. Due to the addition of more sophisticated features since JDK 4's introduction, it has quickly emerged as the preferred I/O system among numerous engineers. The improved support it offers for file handling and file system features is one of the features that distinguish Java NIO. Since the NIO file classes have such incredible capabilities, it is extensively used in file handling. If you look closely, you'll notice that java.nio package specifies the buffer classes employed by ... Read More

Object Model in Java

Deepti S
Updated on 15-May-2023 17:48:15

675 Views

Overview of Object Model Have you ever thought about how software programs can see and communicate with the components that make them up? The object model is useful in this situation. Developers can represent those components as objects using sophisticated object-oriented techniques thanks to a strong system or interface. The object model is actually so crucial to software development that it's frequently one of the first stages. The object model establishes the framework for a reliable, adaptable, and scalable application design by defining crucial features like inheritance and encapsulation. Are you set to learn more about object-oriented programming? Objects and ... Read More

Numbers in Java (With 0 Prefix and with Strings)

Deepti S
Updated on 15-May-2023 17:45:03

555 Views

Numbers in Java It's important to understand that the number class isn't a tangible class, but rather an abstract one. Inside it, we have a set of wrapper classes that define its functions. These wrapper classes include Integer, Byte, Double, Short, Float, and Long. You may notice that these are the same primitive data types we previously discussed, but they're represented as individual classes with capitalized names in keeping with class naming conventions. The compiler automatically converts primitive data types into objects and vice versa, based on the requirements of a particular function or program scope, and the number class ... Read More

Object Compression in Java with Examples

Deepti S
Updated on 14-Jul-2023 16:14:07

70 Views

Object Compression in Java Java objects can be stored and transmitted more easily by using a method called Java Object Compression to shrink their size. The object will be compressed using a variety of classes and methods during this process, which can greatly decrease the size of the data. The complete amount of information can be retrieved by the recipient by decompressing the compressed object after it has been sent. When dealing with scarce resources, such as network bandwidth or disc space, this method can be helpful. In this article, we will learn more about Java object compression. What ... Read More

Advertisements