3 Glasses and 10 Coins Puzzle
The 3 glasses and 10 coins puzzle is a classic logic puzzle that goes like this: You have three glasses on a table. The first… Read More »3 Glasses and 10 Coins Puzzle
Java Parent
The 3 glasses and 10 coins puzzle is a classic logic puzzle that goes like this: You have three glasses on a table. The first… Read More »3 Glasses and 10 Coins Puzzle
This is a classic puzzle known as the “Black and White Hats” puzzle. The solution involves the students devising a strategy beforehand to maximize the… Read More »Black and White Hats Puzzle
To print a stack trace to log you Should declare logger and method info(e.toString()) or log(Level.INFO, e.toString()). Logging is the process of writing log messages during… Read More »Java print stack trace to log | Logger class
Using Core Java API to print the stack trace to strings provides an easy and efficient way to convert stack trace to string using StringWriter and PrintWriter. A… Read More »Java print stack trace to string | How to Convert Program example
Try catch and finally, Java block is used to handle an exception in programs. Each block has its own functionalities and is important. This block… Read More »try catch finally Java Blocks | Exception Handling Examples
Java return keyword is used in a method to get return value after execution is completed. In the method when the return statement is executed,… Read More »Uses of Return keyword in Java | Get value, Statement & Examples
Finally block in java is very important, it has crucial statements that must be executed whether an exception occurs or not. A “finally bock” is… Read More »Use finally block in java | Exception handling
Try and Catch are blocks in Java programming. It’s used for exception handling in Java. Where try block contains a set of statements where an… Read More »try catch Java Block | Exception handling example
The “finally” will be called after the execution of the try or catch code blocks. Some programmers think finally block always executes, no matter what. But it’s not true.… Read More »When finally block is not executed OR finally block always get executed in Java
Actually, probably the “best” way to initialize the ArrayList is the method is not needed to create a new List in any way. There are many ways to do… Read More »Best Way to Initialization ArrayList in one line | Java List