Found 9150 Articles for Object Oriented Programming

Numbers in Java (With 0 Prefix and with Strings)

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

1K+ 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

400 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

NotSerializableException in Java with Examples

Deepti S
Updated on 15-May-2023 17:33:49

2K+ Views

NotSerializableException in Java In Java programming, the NotSerializableException is a common exception that occurs when an object of a class is not Serializable. When an object is not Serializable, it means that the object cannot be converted into a sequence of bytes, which is required for data persistence and communication between software components. The NotSerializableException can be thrown either by the serialization runtime or by the object instance itself. This exception is a subclass of ObjectStreamException, which is the superclass for all exceptions related to Object Stream classes. ObjectStreamException extends IOException, indicating that an I/O exception has occurred. Since serialization ... Read More

New Features of Java 12

Deepti S
Updated on 15-May-2023 17:32:26

302 Views

Introduction to New Features of Java 12 On March 19, 2019, Java 12 was made available. Several new and enhanced features included in Java 12's release make it a worthwhile upgrade over Java 11 in almost every way. Switch Expressions, Default CDS Archives, Shenandoah, and Microbenchmark Suite are a few of the Java 12 features that deserve special mention. To increase Java's productivity, usability, and versatility for coders, these features have been added. We'll talk in-depth about these new capabilities in this article. Switch Expressions (JEP 325) Something interesting to point out is that Java 12 has brought about a ... Read More

Need of Concurrent Collections in Java

Deepti S
Updated on 15-May-2023 17:30:39

2K+ Views

Concurrent Collections in Java Java is a well-known computer language that supports concurrency and multithreading. Developers can use the synchronization keyword to guarantee correct synchronization between threads. Additionally, a variety of collections that can be used to hold and manipulate data are offered by Java's collection framework. The synchronized keyword can be used by coders to make these collections thread-safe. The efficient and secure execution of programs involving numerous threads operating concurrently depends on this capability. What Is the Need of Concurrent Collections in Java? ArrayList, LinkedList, HashSet, HashMap, and LinkedHashMap are just a few of the classes in Java's ... Read More

Taking a Snapshot from System Camera using OpenCV in Java

Siva Sai
Updated on 15-May-2023 15:53:30

492 Views

Introduction OpenCV (Open Source Computer Vision Library) is an open-source computer vision and machine learning software library. It contains more than 2500 optimized algorithms, which are extensively used in real-time applications. Java provides bindings to OpenCV via the JavaCV library, allowing Java developers to leverage OpenCV's capabilities in their applications. One such application is capturing images from a webcam. Prerequisites To follow along, you need to have the following − OpenCV installed on your system. JavaCV, a wrapper for OpenCV in Java. Capturing a Snapshot using OpenCV To capture a snapshot, we need to create an ... Read More

System.out.println in Java

Siva Sai
Updated on 15-May-2023 15:47:08

54K+ Views

Introduction System.out.println is a method in Java that prints a message to the standard output (typically the console) and appends a newline character. It's widely used to display messages, data, and the results of operations during the execution of a program. This method is essential for understanding the flow of your code and debugging potential issues. Breaking Down System.out.println System.out.println may seem like a simple method, but it's worth understanding its components to get a better grasp of how it works. System − A built-in class in the java.lang package. It cannot be instantiated and provides access to standard input, output, ... Read More

Swapping items of a list in Java _ Collections.swap() with Example

Siva Sai
Updated on 15-May-2023 15:41:37

322 Views

This article will provide an in-depth explanation of how to swap items in a list using the Collections.swap() method in Java. This topic is crucial for anyone looking to strengthen their data manipulation skills in Java, especially in dealing with list data structures. Java provides an extensive suite of tools for manipulating collections, including lists. One of these tools is the Collections.swap() method, which allows developers to easily swap the positions of two elements in a list. This method can be extremely handy when you need to rearrange elements in a list for various purposes, such as sorting, shuffling, or ... Read More

Swap Corner Words and Reverse Middle Characters

Siva Sai
Updated on 15-May-2023 15:38:37

454 Views

In this article, we'll delve into a fascinating string manipulation problem that involves swapping corner words of a string and reversing the middle characters. This kind of problem is quite common in coding interviews, and it's a great way to enhance your understanding of string manipulation in Java. Java provides a rich set of tools for string manipulation. From basic operations such as concatenation and comparison to more complex tasks such as string reversing and swapping, Java's String API can handle it all. One intriguing problem is to swap the corner words of a string and reverse the middle characters. ... Read More

Sum of Array Divisible by Size with Even and Odd Numbers at Odd and Even Index in Java

Siva Sai
Updated on 15-May-2023 15:11:05

308 Views

Understanding how arrays work is fundamental for any developer, and Java is no exception. Arrays in Java are objects that store multiple variables of the same type. However, arrays can often be used in more complex ways. One such instance is when you need to figure out if the sum of an array, considering only even numbers at odd indices and odd numbers at even indices, is divisible by the size of the array. In this article, we will guide you step-by-step on how to solve this problem. Problem Statement Given an array of integers, write a function in Java ... Read More

Advertisements