Java | Eklavya Online

Java

Java Tutorials

I have written a lot of java tutorials here into many categories. Some of them are in core java tutorial whereas some of them are in J2EE tutorial or Java EE tutorial area. As the number of posts grows, keeping track of them becomes harder. So I have provided a summary post for most of …

Java Tutorials Read More »

Facade Pattern

Facade Pattern: A Facade Pattern says that just “just provide a unified and simplified interface to a set of interfaces in a subsystem, therefore it hides the complexities of the subsystem from the client”. In other words, Facade Pattern describes a higher-level interface that makes the sub-system easier to use. Practically, every Abstract Factory is a type of Facade. …

Facade Pattern Read More »

Template Pattern

Template Pattern A Template Pattern says that “just define the skeleton of a function in an operation, deferring some steps to its subclasses”. Benefits: It is very common technique for reusing the code.This is only the main benefit of it. Usage: It is used when the common behavior among sub-classes should be moved to a …

Template Pattern Read More »

Java 8 Consumer examples

Consumer definition Consumer takes single argument and do not return any result.Here is the definition of Consumer interface. @FunctionalInterfacepublicinterface Consumer<T> {/*** * Performs this operation on the given argument. * * @param t the input* argument*/void accept(T t); default Consumer<T> andThen(Consumer<? super T> after) {Objects.requireNonNull(after);return (T t) -> {accept(t);after.accept(t);};}} It has a functional method called accept() and default methodandThen(). Consumer …

Java 8 Consumer examples Read More »

Design Patterns

A design patterns are well-proved solution for solving the specific problem/task. Now, a question will be arising in your mind what kind of specific problem? Let me explain by taking an example. Problem Given: Suppose you want to create a class for which only a single instance (or object) should be created and that single object can …

Design Patterns Read More »

Java Interview Questions for Beginners

1. Why Java? We use Java programming everywhere. We use Java to create standalone programs, web applications, and web services. We           can create distributed enterprise applications using Java EE frameworks. 2. What is difference between JavaScript and Java? Some of the key differences between JavaScript and Java are: Java is …

Java Interview Questions for Beginners Read More »

Java 8 features

Important features of java 8 are: forEach() method in Iterable interface default and static methods in Interfaces Interface Changes Functional Interfaces and Lambda Expressions Java Stream API for Bulk Data Operations on Collections Java Time API Collection API improvements Concurrency API improvements Java IO improvements Miscellaneous Core API improvements forEach() method in Iterable interface Whenever …

Java 8 features Read More »

Java 8 Supplier examples

In this post, we are going to see about java 8 Supplier interface.Supplier is functional interface which does not take any argument and produces result of type T.It has a functional method called T get() As Supplier is functional interface, so it can be used as assignment target for lambda expressions. Here is source code of Java 8 supplier interface. package java.util.function;/*** Represents a …

Java 8 Supplier examples Read More »

Creational Design Pattern

Creational design patterns are concerned with the way of creating objects. These design patterns are used when a decision must be made at the time of instantiation of a class (i.e. creating an object of a class). But everyone knows an object is created by using new keyword in java. For example: StudentRecord s1=new StudentRecord();   Hard-Coded code is …

Creational Design Pattern Read More »

Java Interview Questions for Intermediate

1.What is JVM? Why is Java called the “Platform Independent Programming Language”? A Java virtual machine (JVM) is a process virtual machine that can execute Java bytecode. Each Java source file is compiled into a bytecode file, which is executed by the JVM. Java was designed to allow application programs to be built that could …

Java Interview Questions for Intermediate Read More »