Practical solutions

Java Howtos How-To Guides

Solve the problem. Keep building. Collection of Java how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Handle Regex Special Characters in JavaThis article explains the special characters used in regex in Java. How to Declare a Constant String in JavaThis tutorial demonstrates how to declare a constant string in Java. Java getContentPane()This tutorial demonstrates how to use getContentPane() in Java Swing. How to Get the Subset of an Array in JavaThis tutorial demonstrates how to get a subset of an array in Java. How to Read File From Classpath in JavaThis tutorial demonstrates how to read a file from classpath in Java. How to Print Contents of Text File to Screen in JavaThis article will show you how to use Java to print the contents of a text file on the screen. How to Copy Text to Clipboard in Java in JavaThis article discusses the method of copying text from a Java application to the clipboard. How to Fix Error: Javac Cannot Find Symbol Error in JavaThis tutorial demonstrates how to solve the javac cannot find symbol error in Java. How to Fix Exception in Thread Main Java.Util.NoSuchElementException: No Line FoundThis tutorial demonstrates how to solve the Exception in thread main java.util.NoSuchElementException: No line found in Java. How to Fixe Error: Java Char Cannot Be DereferencedThis tutorial demonstrates how to solve the Char Cannot be Dereferenced error in Java. How to Resolve Unreported Exception IOException Must Be Caught or Declared to Be Thrown in JavaThis article covers causes, solutions, methods, and best practices for Unreported Exception IOException in Java. How to Resolve the Package Does Not Exist Error in JavaThis tutorial uses a code example to demonstrate the package does not exist error in Java. It also identifies the reason and provides the solution for that. How to Print HashMap in JavaThis article introduces how to print HashMap in Java. How to Round a Double to Two Decimal Places in JavaThis tutorial introduces how to round a double to two decimal places in Java in different ways. How to End a Java ProgramThe article explains the safest ways to end a program in Java. How to Close a Scanner in JavaThis article explains how and when to close a scanner in Java How to Convert Binary String to Int in JavaThis tutorial explains the ways on converting a binary string to int in Java. How to Check if an Object Is Null in JavaThis tutorial explains the ways to check whether an object is null or not in Java. How to Count Characters in a String in JavaThis article shows the different methods to count the characters in a string in Java. How to Swap Arrays in JavaThis tutorial discusses different methods to swap two arrays in Java, such as numeric operators, bitwise operators, Collections.swap(), and a temporary variable. How to Sort 2D Array in JavaThis article discusses how to sort a 2D array in Java using two distinct approaches: column-wise sorting using the Comparator interface and row-wise sorting using the Arrays.sort() method. How to Get Year From Date in JavaThis article will explore various methods to extract the current year from a date in Java, ranging from modern solutions like the java.time.LocalDate class to traditional options like java.util.Calendar and even unconventional approaches such as using String.split(). How to Fix java.util.date to java.sql.date in JavaThis tutorial teaches how to convert java.util.Date to java.sql.Date and by covering best practices and insights into common pitfalls. Difference Between i++ and ++i Operators in JavaThis article introduces the difference between i++ and ++i operator in Java.