Object Identity Strings in Java (with Examples)
In Java, an identity string is a unique identifier associated with an object instance without calling the overridden toString() or hashCode() methods.
In Java, an identity string is a unique identifier associated with an object instance without calling the overridden toString() or hashCode() methods.
Learn the differences between Sourcepath, Classpath and Buildpath and how they contribute to an application’s development, build and deployment phases.
In Java, local variables are thread-safe because they are stored on the stack memory, which is a unique space allocated to each thread when it is created.
Java has 51 reserved words and 16 contextual keywords that cannot be used as identifiers in the code. Programmers should not use these keywords for other purposes.
Learn to convert a given Java object into a Map using different solutions including Jackson ObjectMapper, Gson and Java reflection.
Learn to print formatted output in Java using the format() and printf() methods. Learn to format strings, date-time, floats with precision.
After the legacy Java finalization has been deprecated (JEP-421) in Java 18, learn the basics of Cleaner API and how to use it.
In Java, a text block is a multi-line string literal. It means we do not need to get into the mess of explicit line terminators, string concatenations, and delimiters.
The program arguments passed at launching the Java program are called command line arguments. While launching the program we can pass additional arguments (no limit of numbers of arguments).
Java naming conventions are sort of guidelines that application programmers are expected to follow to produce consistent and readable code throughout the application. If teams do not follow these conventions, they may collectively write an application code that is hard to read and difficult to understand. Always try to give …
In Java, control flow statements help in conditionally executing statements based on whether the evaluation result is true or false.
Starting from Java 10, Oracle has adapted time based version-string scheme [JEP 322]. The new time-based model has replaced the feature-based, multi-year release model of the past. Unlike the old releases, the new time-based releases will not be delayed and features will be released every six months, with no constraints …
Inside a Java program, we can write a special text that will be ignored by the Java compiler — known as the comment. Comments allow us to exclude code from the compilation process (disable it) or clarify a piece of code to yourself or other developers. Learn everything about Java comments, …
JDK, JRE and JVM is very common words when developers talk about java applications and their development environments. Let’s find out the differeneces between these words.
JPMS (Java Platform Module System) is the major enhancement in Java 9. It is also known as Project Jigsaw. In this Java 9 modules tutorial, we will learn about modules (in general) and how your programming style will change in future when you will start writing modular code.
Learn to use java.util.Random, Math.random(), SecureRandom and ThreadLocalRandom to generate random numbers based on your application requirements.
Use given syntax examples for setting CLASSPATH for any java application runtime, in windows and linux environments.
Let’s look at a few Java examples of conversions between decimal, binary, octal, and hexadecimal. All examples use native Java APIs without adding any more complexity.
A block statement is a sequence of zero or more statements enclosed in braces. A block statement is generally used to group together several statements, so they can be used in a situation that requires you to use a single statement. 1. What is a Block Statement? Generally, a java …
A statement specifies an action in a Java program. For example, a statement may tell the add of values of x and y and assign their sum to the variable z. It then prints a message to the standard output or writes data to a file, etc. Java statements can …
Java is concurrent, object-oriented, and intended to let application developers “write once, run anywhere” (WORA). Java is considered a fast language, almost as fast as languages like C and Rust, but it uses a lot of memory in comparison to these languages. 1. What is Java Programming Language Java is …
Whenever we execute a Java program, a separate memory area is reserved for storing various parts of our application code which we roughly call JVM memory. Though not necessary, having some knowledge about the structuring of this memory area is quite beneficial. Knowing Java memory model becomes more important when …
Reflection is one of those things like multi-threading where everyone with experience of it says “Don’t use it unless you absolutely have to”. Above quote is absolutely true for all for us alike. In my previous tutorial, I discussed basics of annotation in which I discussed the usage of reflection …
Java 8 introduced ‘java.util.Base64‘ utility class that provides built-in support for performing base64 encoding and decoding operations as specified in RFC 4648 and RFC 2045. Let us explore Base64 encode and decode processes with various usecases with examples. 1. What is Base64? Base64 is a binary-to-text encoding scheme that converts …
Java 8 has brought many awesome features for java developers. Some of them I have already described in Comparator changes, Streams examples, Internal vs. external iterations, predicates, functional interfaces, default methods, lambda expressions and date and time API changes. All above changes were related to lambda expressions, which is the …
Since Java 8, we can use String.join() method to concatenate strings with a specified delimiter. For advanced usages, use StringJoiner class.
Learn the difference between internal iteration and external iteration in Java with examples. 1. External Iteration Till Java 7, the collections framework relied on the concept of external iteration where the Collection provides a means to enumerate its elements by implementing the Iterator interface. The clients use the iterator to …
Java labeled loops help in the case of nested loops when we want to break or continue a specific loop out of those multiple nested loops.
This post is next update in sequence of discussions regarding little known features of java. Please subscribe through email to get updated when next discussion goes live. And do not forget to express your views in comments section. Java is a safe programming language and prevents programmer from doing a …
Timer is a utility class which is used to schedule tasks for both one time and repeated execution in spring applications. Timer is dependent on system clock
This Java article compares the performance of an ArrayList iteration using simple for-loop, enhanced for-loop, list iterator and stream API.
Java is passed by value and not pass-by-reference. If it had been pass-by-reference, we should have been able to C like swapping of objects.
A clone is an exact copy of the original. The java clone() method provides this functionality. Learn to create shallow copy, deep copy and using copy constructors in Java.
Learn Java finalize() signature, the purpose of finalization, how can we call finalize() method manually, and why you should not use it.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.