Friday, January 29, 2021

Generating a stream of Fibonacci numbers

A Java stream represents potentially an infinite sequence of data. This is a simple post that will go into the mechanics involved in generating a simple stream of Fibonacci numbers.The simplest way to get this stream of data is to use the generate method of Stream.As you can...

Wednesday, January 27, 2021

The Temporary Test Property

It may be seen in languages such as JavaScript where there’s a master let setting up some useful variables for various tests to use to assign values to. I’ve more seen it in Java though, where there can be a sort of phobia of creating temporary variables inside...

Monday, January 25, 2021

Extends vs Implements in Java

Inheritance is an important pillar of OOP(Object Oriented Programming). It is the mechanism in Java by which one class is allowed to inherit the features(fields and methods) of another class. There are two main keywords, “extends” and “implements” which are used in Java for inheritance. In this article,...

Friday, January 22, 2021

Testing Logging Output in Java

Testing that the logged output is as expected seems to be on the cusp of a good/bad idea. Is the logged output the intended behavior of the application? or is it an implementation detail that you’re just mirroring in a test?Arguably, it’s sometimes the former… logging is the...

Wednesday, January 20, 2021

How to get current date time with Java 8

In this quick tutorial, we will see, how to get current date time using Java 8.Java 8 had come up with new set of classes for date and time under java.time package, which are:–  java.time.Instant– java.time.ZonedDateTime– java.time.OffSetDateTime– java.time.LocalDateTimeLet us see how we can get current date and time...

Monday, January 18, 2021

Static Nested Classes Java

In Java, it is possible to define a class within another class. Class defined within another Class is called a Nested Class.Nested class is treated as a member of the Outer class because it is also defined within the Outer class like its other members(variables or methods).public class...

Friday, January 15, 2021

Difference between Java and C language

Here are some of the differences between Java and C language. C is much faster than JavaJava is slower than C due to overhead. C JAVA  C was developed by Dennis M. Ritchie between 1969 and 1973. Java was developed by James Gosling in 1995. C is a Procedural...

Wednesday, January 13, 2021

Builder Design Pattern

We will discuss Builder design pattern.Key topics we are going to discuss are :– Which category Builder Design Pattern falls in ?– What problem builder Pattern is solving or when to use Builder pattern?– Builder Pattern– Builder Pattern Example– Advantages of Builder Pattern– Disadvantages of Builder PatternWhich category...

Tuesday, January 12, 2021

Why Java is not a purely Object-Oriented Language?

Pure Object Oriented Language or Complete Object Oriented Language are Fully Object Oriented Language which supports or have features which treats everything inside program as objects. It doesn’t support primitive datatype(like int, char, float, bool, etc.). There are seven qualities to be satisfied for a programming language to...

Monday, January 11, 2021

enum in Java

Enumerations serve the purpose of representing a group of named constants in a programming language. For example the 4 suits in a deck of playing cards may be 4 enumerators named Club, Diamond, Heart, and Spade, belonging to an enumerated type named Suit. Other examples include natural enumerated...

Sunday, January 10, 2021

Generating random numbers in Java

Java provides three ways to generate random numbers using some built-in methods and classes as listed below:◉ java.util.Random class◉ Math.random method : Can Generate Random Numbers of double type.◉ ThreadLocalRandom class1) java.util.Random◉ For using this class to generate random numbers, we have to first create an instance of...

Pages (26)1234567 »