Monday, 10 August 2020

Spring Boot @ConfigurationProperties and Properties File

 In this tutorial, you will learn to use @ConfigurationProperties to map properties files to POJO classes in Spring Boot application. Let’s get started to build a simple example with Java and Maven

What you’ll need

    Your favorite IDE

    JDK 8+ or OpenJDK 8+

    Maven 3+

List the key features of Angular 8?

 The key features of Angular 8 are as follows:

  • Differential Loading to create two different production bundles of your app.
  • New Dynamic Lazy Loading modules for imports.
  • Supports Web Workers.
  • Supports TypeScript version 3.4.
  • Availability of New Workspace APIs and Builder.
  • Bazel Support.
  • Opt-In usage sharing.
  • Ivy Rendering Engine: The new compiler for Angular version 8.
  • ngUpgrade improvements.

Wednesday, 5 June 2019

What is a Functional interface in Java 8? What does @Functional annotation do?

What is Functional interface in Java 8

Well, a functional interface is nothing but an interface with just one abstract method e.g. Comparable, Runnable, EventListener, Comparator, etc. You can see these interfaces were present in Java even before JDK 8, but why do we call such interface functional interface?

Explain comparable interface in java

By using Comparable we can sort the objects based on any data member. For example, lets say we have an Author class has data members: Author name, book name and author age, now if we want to sort the objects based on any of the data member then we can use Comparable but what if we want to have multiple sort choices and we can sort objects based on any choice, this can be done using

Abstract class in java can’t be instantiated

Because that would contravene their whole purpose.

Abstract classes, by design, are not complete or functional. They are meant to serve as a base from which complete classes can be built, by aggregating the common members and methods that they all will need into an abstract base class, and then allowing the inheriting classes to fill out the necessary

Abstract Class in Java

Abstract class in Java is similar to interface except that it can contain default method implementation. An abstract class can have an abstract method without body and it can have methods with implementation also.

Friday, 31 May 2019

How to create immutable class in Java

An immutable class is one whose state can not be changed once created. There are certain guidelines to create a class immutable in Java.

1. Rules to create immutable classes

Don’t provide “setter” methods — methods that modify fields or objects referred to by fields.

Why Strings are Immutable in Java?

An immutable object is an object which state is guaranteed to stay identical over its entire lifetime. This is really a good definition. Isn’t it? It means that the state of object once initialized, can never be changed anyhow.

What is Marker interfaces in Java and why required

Marker interface in Java is interfaces with no field or methods or in simple word empty interface in java is called marker interface. Example of market interface is Serializable, Clonnable and Remote interface. Now if marker interface doesn't have any field or method or behavior they why would Java needs it?

Wednesday, 29 May 2019

important Interface interview questions

1) Can abstract class have constructors in Java?

Yes, abstract class can declare and define constructor in Java. Since you can not create instance of abstract class,  constructor can only be called during constructor chaining, i.e. when you create instance of concrete implementation class.

Spring Boot @ConfigurationProperties and Properties File

 In this tutorial, you will learn to use @ConfigurationProperties to map properties files to POJO classes in Spring Boot application. Let’s ...