Home » java basics

Tag Archives: java basics

Java 8 Stream – flatMap & Optional Example

Hello. In this tutorial, we will talk and understand the most commonly used Java 8 Stream APIs: the flatMap method and the Optional class. 1. Introduction Before diving deep into the practice stuff let us understand the flatMap method and Optional class in java programming. 1.1 flatMap() method This method is used to convert a stream of collections to a ...

Read More »

Java 8 Stream – Map & Collect Example

Hello. In this tutorial, we will explain the most commonly used Java 8 Stream APIs: the map() and collect() methods. 1. Introduction Before diving deep into the practice stuff let us understand the map and collect methods. 1.1 map() method This method is used to convert an object to something else. Represented by the syntax – map() method <R> Stream<R> ...

Read More »

Java 8 Stream – filter() & forEach() Example

Hello. In this tutorial, we will explain the most commonly used Java 8 Stream APIs: the forEach() and filter() methods. 1. Introduction Before diving deep into the practice stuff let us understand the forEach and filter methods. 1.1 forEach method This method is used to iterate the elements present in the collection such as List, Set, or Map. It is ...

Read More »

Java Programming Basics

1. Introduction Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems, Inc. in 1991. It is formally known as OAK. In 1995, Sun Microsystem changed the name to Java. In 2009, Sun Microsystem takeover by Oracle Corporation. In this tutorial, we are going to learn the basics of Java Programming. We will ...

Read More »

Could Not Find or Load Main Class in Java

In this tutorial, we will explain the error: could not find or load main class, the most common runtime exception in Java programming. The error usually occurs if the java command is unable to find or load the class that contains the main() method. 1. Introduction Before digging deep into the solution let us understand a few reasons for this error ...

Read More »

Java Heap and Stack

Hello readers, in this tutorial, we will learn about Heap space and Stack in Java. 1. Introduction In Java, the Java Virtual Machine (JVM) divides the memory into two parts i.e. Java Heap Space and Java Stack Memory. 1.1 Java Heap Space? Created by the JVM when it starts and the memory is allocated until the application is running Memory ...

Read More »

Float vs Double Java Example

Hello readers. In this tutorial we will learn about the float and double data types in the Java programming language. More specifically, we feature a comprehensive article about Float vs Double Java. 1. Introduction In Java programming, float and double data types both represent in floating-point numbers but a double data type is a little more precise than float. 1.1 ...

Read More »

How to write Java Doc

In this tutorial, we will learn how to write a Java Documentation (Java Doc or Javadoc) and the usage of JavaDoc tags. 1. Java Doc – Introduction We can use any JavaDoc tool of their preference or the ALT + SHIFT + J key for generating a standard HTML documentation. In this tutorial, we will primarily focus on the keyboard ...

Read More »

Getters and Setters Java Example

Hello readers! In this tutorial, we feature a comprehensive Getters and Setters in Java example. We will learn the Accessor and Mutator in Java programming language. 1. Introduction Java programming offers Accessor and Mutator or popularly called as Getter and Setter methods that are used to update the variable values and retrieve them. The following class illustrates the private variables ...

Read More »

Java XOR Operator Example

Hello readers, in this tutorial, we will explain the Java XOR operator. We’ll cover the XOR symbol that is an operator that falls under the Bitwise category. 1. Introduction Java programming offers Operators that are used to perform various operations in Java. 1.1 XOR operator in Java The XOR operator is denoted as ^ in the programming language and works ...

Read More »