Found 2616 Articles for Java

NotSerializableException in Java with Examples

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

825 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

206 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

260 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

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

Symmetric Encryption Cryptography in Java

Siva Sai
Updated on 15-May-2023 15:45:35

2K+ Views

Introduction Symmetric encryption, also known as secret-key encryption, is a type of encryption where the same key is used for encryption and decryption. This encryption method is fast and efficient, making it suitable for encrypting large amounts of data. The most commonly used symmetric encryption algorithm is the Advanced Encryption Standard (AES). Java provides strong support for symmetric encryption with the javax.crypto package, which includes classes such as SecretKey, Cipher, and KeyGenerator. Symmetric Encryption in Java Java's Cipher class in the javax.crypto package provides the functionality of a cryptographic cipher for encryption and decryption. It forms the core of the ... Read More

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

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

133 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

258 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

203 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

Size of file on the Internet using Java

Shriansh Kumar
Updated on 15-May-2023 17:35:08

360 Views

Determining the size of a file on the Internet seems a little tricky, but it is a quite simple and easy task. Java provides some built-in features that can be used for the given task. In this article, we will discuss how to make a connection to the Internet and fetch the size of a given file. How to establish a Connection on Internet using Java URL The modern Internet is all about World Wide Web. Tim Berners-Lee invented a way to locate all the resources on Web and he named it Uniform Resource Locator. It provides the feature ... Read More

Advertisements