Catch multiple exceptions before & after java 7 (examples)
What is exception (background)? Exception occurs in an application mostly due to programming mistakes. e.g. NullPointerException occurs, when we try […]
We will discuss commonly asked questions related to java 8 , exception handling, string operations, java io etc.
What is exception (background)? Exception occurs in an application mostly due to programming mistakes. e.g. NullPointerException occurs, when we try […]
What is user defined or custom exception in java? User defined exceptions is concrete class extending exceptions like Exception, RuntimeException
Create a user defined exception in java. Create a custom exception, by extending unchecked exceptions. We will create CustomArithmeticException by extending
Given a message, We would like to encrypt & decrypt plain/cipher text using AES CBC algorithm in java. We will
Given a java application, We would like to read the property file defined in HOCON (Human-Optimized Config Object Notation.) or
What we will have in this post ? We will create a maven project and add apache shade plug-in. Create runnable
File read write IO operation in java using StringWriter & StringReader. StringWriter write contents as String & StringReader read file as String (example).
PrintWriter writes the formatted data to output stream. PrintWriter provides the methods to write int, boolean, char, String, double, float
Given the contents, we would like to create or write to file using CharArrayWriter class in java. Read contents from file
Given the UTF contents, read & write utf contents using BufferReader & BufferWriter. Use java nio feature to create BufferReader & BufferWriter.
Given UTF contents, read & write utf contents using BufferReader & BufferWriter in java. Write UTF contents to the file
Given the UTF contents, read & write utf contents using InputStreamReader & OutputStreamWriter. We have already discussed similar posts: Read & write UTF file
Read & write file using BufferedReader/BufferedWriter (NIO) with example. BufferWriter writes to character stream & BufferReader, reads character stream.
BufferWriter, writes to character based stream and BufferReader, reads from character based stream, so as to provide efficient writing/reading of
Read & Write file in java using InputStreamReader & OutputStreamWriter class. We will write contents to a file using OutputStreamWriter
Create or write file in java using FileOutputStream class. FileOutputStream writes the contents to file as stream of bytes. The
1. What is unchecked exception in java? Unchecked exceptions are not checked at compiled time. The unchecked exceptions are not forced
Difference between checked and unchecked exceptions in java. Discuss the exception class hierarchy showing checked & unchecked exception in java.
We will discuss the difference between error & exception in java. We will demonstrate exception class hierarchy in java. We
What is OutOfMemoryError ? The OutOfMemoryError is thrown by JVM, when JVM does not have enough available memory, to allocate. OutOfMemoryError falls
Create & simulation deadlock situation using multiple threads (concurrency). Cyclic dependency of resource results in deadlock (example/java)
1. What is throw in java? throw is a keyword in java. When an exceptional or unintended situation occurs in
Let us discuss final, finally and finalize in java with code examples. What is final ? final is a keyword
1. What is immutable class? The class whose state does not change after its construction is called immutable class. There
StringBuilder and StringBuffer are mutable classes StringBuilder & StringBuffer are mostly used, when we expects the modifications in string. e.g. Join two
1. Different methods to join or concatenate strings in java Join String using + operator Combine String using String concat method Contact String
Java stream library have streams specifically for primitive types like int, long, double etc. With primitive streams, values are directly
Java 8 Stream: groupBy, mapping and statistics, lambda stream example. Discussed IntSummaryStatistics (min,max,avg) of List of Person objects.
Given an enum in java. Convert enum to integer & vice Versa. Convert enum to string value & vice Versa.
Create a temporary file in java. We can create temporary file by specifying prefix, suffix (or directory) We will demonstrate