Java Series Part 6 – Classes, Objects and Methods

A method is a block of code which only runs when it is called. You can pass data, known as parameters, into a method. Methods are used to perform certain actions, and they are also known as functions. Java is an object-oriented programming language. Everything in Java is associated with classes and objects, along with its attributes and … Continue reading Java Series Part 6 – Classes, Objects and Methods

Java Series Part 5 – JVM, JRE and ByteCode

JVM, JRE and JDK JVM (Java Virtual Machine) is an abstract machine. It is called a virtual machine because it doesn't physically exist. It is a specification that provides a runtime environment in which Java bytecode can be executed. It can also run those programs which are written in other languages and compiled to Java … Continue reading Java Series Part 5 – JVM, JRE and ByteCode

Java Series Part 4 – Strings & String Concatenation

Strings are used for storing text. A String variable contains a collection of characters surrounded by double quotes: String greeting = "Hello"; A String in Java is actually an object, which contain methods that can perform certain operations on strings. For example, the length of a string can be found with the length() method: String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; System.out.println("The … Continue reading Java Series Part 4 – Strings & String Concatenation

Java Series Part 3 – Variable/Data Types

Primitive Data Types Data types that can store integer values: int i;byte b;short s;long l; Variable types: byte b = 5; //8bits - 128 to 127short s = 128 //16bits - 32,768 to 32,767int i = 40000; //32 bits - 2,147,483,648 to 2,147,483,647long l = 222222222; //64bits -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807float f = 4.0f; //32 bits … Continue reading Java Series Part 3 – Variable/Data Types

Java Series Part 2: Java Variables

Variables in Java are containers for storing data values. In Java, there are different types of variables, for example: String - stores text, such as "Hello World". String values are surrounded by double quotes int - stores integers (whole numbers), without decimals, such as 15 or -15 float - stores floating point numbers, with decimals, such as 1.99 or -1.99 … Continue reading Java Series Part 2: Java Variables

Java Series Part 1: Java Expressions

A Java expression consists of variables, operators, literals, and method calls. package com.java.basic; public class ExpressionsExample { public static void main(String args[]) { // 5 + 2 is an expression int add = 5 + 2; System.out.println("Addition= " + add); // 5 - 2 is an expression int sub = 5 - 2; System.out.println("Substraction= " + … Continue reading Java Series Part 1: Java Expressions

Spring Boot-Series Part 1: Setting up the maven based Spring boot application in STS or Eclipse IDE

We can create a simple spring boot project with spring initialzr or directly in STS. We will use spring initializr for this tutorial to create an simple spring boot project. Required softwares are: Java JDKSTS 4Maven 3.5Postman Let us get started. 🙂 Step 1: Go to https://start.spring.io/ Step 2: Fill the details like Project type … Continue reading Spring Boot-Series Part 1: Setting up the maven based Spring boot application in STS or Eclipse IDE

Mockito 101 – Unit Testing in Java Apps

Mockito is an open source framework that allows you to easily create mocks (test doubles). Mocks are objects that have return values to method executions made during the test and has recorded expectations of these executions. Mocks can also throw an exception if they receive a call they don’t expect. They are checked during verification to ensure … Continue reading Mockito 101 – Unit Testing in Java Apps