Home » Core Java

Core Java

Java Methods Explained

In this article, we will introduce you to Java Methods. First of all, we will talk about what is a method and why we use methods. After that, we will analyze the method syntax and some useful abilities of it. 1. Introduction A Java method is a block of code that is grouped to perform an operation. When calling a ...

Read More »

Hashset Java Example

1. Introduction The HashSet class is a part of Java Collection API since JDK 1.2. It extends from the AbstractSet class and implements the Set interface. It uses HashMap internally. Figure 1 HashSet The HashSet class contains unique elements. It permits the null element. It does not maintain the insertion order and is not thread-safe. In this example, I will ...

Read More »

Java Hello World Example

In this article, we show you how to write a Java Hello World Example. This program is the first for most of the programmers and it will introduce to you the magic world of Java programming. Firstly, we will show you how to install Java. After that, we will analyze the example and then we will talk about how to ...

Read More »

ToString Java Example

In this article we will learn about the toString Java method in Object class. 1. Introduction The toString() method in the Object class returns a string representation of the object. In general, the toString() method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. ...

Read More »

Overloading Java Methods Example

In this post, we feature a comprehensive article on Overloading Java Methods. Overloaded methods are methods with the same name signature but either a different number of parameters or different types in the parameter list. It is similar to constructor overloading, that allows a class to have more than one constructor having different argument lists. Method overloading is an example ...

Read More »

Java Object Tutorial

In this post, we feature a comprehensive article on Java object. The article and the examples used are based on JDK 8. Table Of Contents 1.Introduction 2.Parts of an Object 2.1.Instance variables/methods 2.2.Static variables/methods 2.3.Constructors 2.4.Static initialization blocks 2.5.Instance initialization block 2.6.Finalizer 3.Object Methods 3.1.equals() method 3.2.hashCode() method 3.3.clone() method 3.4.toString() method 3.5.getClass() method 4.Access Modifiers 4.1.Visibility of members 5.Objects ...

Read More »

Nested If Statements in Java

In this article we will look how to write nested if Statements in Java. 1. Introduction in Java Java is a popular programming language, created in 1995. It is owned by Oracle, and more than 3 billion devices run Java. It is used for mobile applications (especially Android apps), desktop applications, web servers, and application servers, games and much more. ...

Read More »

Java Optional Parameters

In this post, we feature a comprehensive article about the Java Optional Parameters. When you design a method in a Java class, some parameters may be optional for its execution. 1. Java Optional Parameters You can tackle Java optional parameters in method in several different ways. We will see them in the following: 1.1 Mutability with accessors Using standard getters ...

Read More »

Topological Sort Java Example

In this article, we will discuss the Topological sort Java algorithm. We will start with graphs, some common types, and to store graphs. 1. Graph and common types A graph is a non-linear data structure consisting of a finite set of Vertices (also called nodes) connected by Edges. Fig 1. A sample Graph with vertices and edges In the above ...

Read More »

Printstream Java Example

This article is a quick introduction to the Printstream Java class available as part of Java ecosystem. 1. Introduction Stream refers to data essentially bytes at lowest level. To read and process data from a source, the data needs to be saved. Outputstream is the means to save the data to a sink. Outputstream is the superclass of all classes ...

Read More »