Home » Core Java

Core Java

Java Unit Testing with JUnit Example

This is an article for Java Unit Testing with JUnit Example. 1. Introduction Java unit testing is a software testing where methods and classes are tested. JUnit is a unit testing framework for the Java programming language which provides a way to test the application as many as you want. Unit testing usually includes the following steps: define a testcreate ...

Read More »

@Override Java Annotation Example

In this article, we will show you about the @Override Java Annotation. Firstly we will talk about what is the override in OOP in general and why we use it. Then we will analyze why we do overrides in methods and last but not least we will do some examples. 1. Introduction In Java, the method overriding is one of ...

Read More »

Treeset Class Java Example

1. Introduction In this article, we will take a look at the Treeset class in Java using examples. TreeSet implements the SortedSet interface in Java which persists in a Tree. The ordering of the elements in a TreeSet is based on natural ordering. 2. TreeSet Java Example TreeSet does not allow duplicate values. TreeSet persists the objects sorted in ascending ...

Read More »

Java Assert Keyword Example

1. Introduction In this article, let us understand the Assert Keyword in Java. An Assertion allows testing the correctness of any assumptions that have been made in the program. An assertion is achieved using the assert statement in Java. While executing an assertion, it is believed to be true. If it fails, JVM throws an error named AssertionError. It is mainly used for testing ...

Read More »

Java BigInteger Class Example

In this article, we will discuss about the Java BigInteger Class – java.math.BigInteger. This interesting class extends the java.lang.Number class and implements the java.lang.Comparable interface. public class BigInteger extends Number implements Comparable 1. Java BigInteger Class – Introduction All operations behave as if BigIntegers were represented in two’s-complement notation (like Java’s primitive integer types). BigInteger provides analogues to all of ...

Read More »

Java Print Example

1. Introduction Java print method is a convenient method found both within the java.io.PrintStream and java.io.PrintWriter class and is used to display a text on the console. The text is passed as a parameter to this method in the form of a String. After printing the text on the console, it places the cursor at the end of the text. ...

Read More »

Migrating from Java 8 to Java 13

In this article, we will demonstrate how to migrate an application from Java SE 8 to Java SE 13. 1. Introduction Oracle began a six-month release cadence for Java Standard Edition starting with Java 10. Instead of being major version releases, they are instead “feature releases”. This release cycle is in the spirit of Continuous Integration / Continuous Deployment and ...

Read More »

Java Final Keyword Example

1. Introduction In a programming language like Java, the word final is a keyword that is used as an access modifier before variables, methods, and classes. A keyword is a word that has special meaning for the compiler and cannot be used as an Identifier in a language. The final word can be used before a variable or before a ...

Read More »

C# vs Java: The Most Important Differences

In this post, we feature a comprehensive article about Java vs C# and their most important differences. Java and C# are the object-oriented programming languages. C# and Java are platform-independent languages. In this tutorial, we see the features of Java and C# to see the differences. 1. Overview We look at the comparison of Java vs C# languages in this ...

Read More »

Java String Methods from Java 8 to Java 14

In this article, we will look at the new string methods added to the Java API from versions 8 to 14. 1. Java String Methods – Java 8 The newly added method in Java 8 is join for joining up the various strings. Let us see the methods with an example: public class StringDemo { public static void main(String[] args) ...

Read More »