Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Read the Specific JSON Property

The below Example will show you how to read the specific property from the file in JSON format or to read the Specific property from the JSON data. emp.txt { "id": 123, "name": "Manish", "phone": [ 123456, 987654 ], ...

Implement Producer Consumer Problem Using Threading in Java

ProducerConsumer problem is also known as the bounded-buffer problem.It is multi-process synchronization problem.There are two processes one is producer and another is consumer that can share a common and fixed-size buffer. The producer insert th...

Read System environment variable in Spring

Hello Friends, The below code will show you how you can read System Environments Variables and System Properties by Using Spring applicationContext. We have to create SystemVariables Class and create the property systemVariables SystemVaria...

Implement Generic Method in Java

Generic Methods:- The Below code will helps you to implement Generic Method using the Generic Programming in Java. The generic methods enable us to specify, with a single method declaration and use with different data types. we can write a single...

How to Construct your own ArrayList Using Generics

Here the Below Example will show you how you can construct your own Collection(ArrayList) in Java. The below example will show you that our Class Generics will behave like the ArrayList. I have use the Generic Programming to Implement the concept...

How to initialize blank final variable

Blank final variables are those variables that are final but havent initialized at the time of declaration. So its not possible to initialize it anywhere. Here is the solution. We can initialize blank final variable only in the constructo...

Comparator Interface in java

Hi, Here I am writing a simple way to use Comparator interface. We use Comparator interface to order the objects. First of all we need to import java.util package. It have two methods : Compare(Object o1, Object o2) equals(Ob...

Static in Java

One of the most important topic that we encounter in java. We can use static with class name, methods name, variables name and block. Static keyword mainly used for memory management. Static variable Static variable takes memory o...

Spring MVC @RequestParam Usses

For Get request we need to pass parameters as request param along with the url to get the data. In Spring MVC framework, we can customize the URL in order to get data. To read the parameters passed with the URl we use @RequestParam in Spring fram...

Spring MVC @RequestParam vs @PathVariable

@PathVariable: Sometimes we need to pass parameters along with the url to get the data. In Spring MVC framework, we can customize the URL in order to get data. For this purpose @PathVariable annotation is used in Spring framework. @PathVariabl...

How to match a word in Java?

Sometimes we need to match some words in a particular String. We can do this easily by matches() method of String class. Example: package com.demo; public class TestApps { /* *@param args */ public static void mai...

How to replace whole word with Word Boundaries in Java?

Sometimes we need to replace whole word with the word boundaries in a string. For this we use "\b" regular expression token which is called a word boundary. It usually matches at the start or the end of a word. Example: You just need to place ...

How to replace Case-Insensitive chars in a String in Java?

Sometimes we need to replace some characters with some other set of characters. To replace a Case-Insensitive chars from string you can use the below example: package com.demo; public class TestApps { /* *@param args */ ...

Use of JPA(Java Persistence API) to implement ORM

JPA:- Java Persistence API is a collection of classes and methods to persist or store data into the database Using the JAVA API. The Below code will show you how you can work with JPA. First we make the POJO. Employee.java package...

HashSet in Java

Here I am writing a way to implement Hashset. HashSet creates hashtable to store the data. As it implements Set interface so it doesnt contains duplicate elements. It also extends AbstractSet class. We can implement HashSet by using different...

Enumeration Interface in Java

Enumeration is used to retrieve or traverse all the elements of particular collection of objects. Its not considered for collections but we can use it for legacy like Vectors. To use it we need to import - Java.util.Enumeration Below is the ...

Iterator in Java

In collection, there would be many situations where we need to retrieve the collection elements. Example, we need to show each element. For these situations Iterator is the best solution. How it implements :- First iterator comes to start p...

Set interface in java

Set Interface in java, It is the type of Collection and Its the subclass of Collection interface so that all methods Collection interface can also present in Set interface. The important feature of Set interface is that it doesnt allow dup...

How to parse/format dates with LocalDateTime in Java 8?

LocalDateTime is an immutable date-time object that represents a date-time, with default format as yyyy-MM-dd-HH-mm-ss.zzz. It provides a factory method that takes LocalDate and LocalTime input arguments to create LocalDateTime instance. Lets loo...

Returning a Collection instead of Stream in Java 8?

In Java 8, the Streams is the new addition in the Java Collections API. It is the new method to process collections of objects. That is a different concept than the IO streams in the Java . Streams can be designed to work with Java lambda express...

What are the differences between abstract classes and interfaces in Java 8?

Difference between abstract class and interface in Java 8 : To create abstract classes we use the 'abstract' keyword whereas keyword 'interface' is used to make the interfaces in Java. For inheritance the 'extends' keyword is used by the su...

Difference between ArrayList and LinkedList

This is one of the important thinks that we need to know when we talk about Collections in Java. There are so many similarities in ArrayList and LinkedList like they implements List interface. They both come under non synchronized classes. ...

TreeSet in Java

TreeSet class is the class that implements NavigableSet interface and NavaigableSet extends SortedSet which extends Set. TreeSet contains unique elements. Another important and powerful property is that it maintains ascending order. To us...

Java Interview Coding problems for Freshers- Part II

In the previous tutorial of Java Interview Questions and Answers Part 1, I have explained some basic coding problems of Java.This part is in continuation with the previous Java Interview Questions and Answers tutorial. In this part of the tutoria...

Map Interface in Java

We use Map Interface for mapping unique keys and values. By using these keys, we can retrieve the mapping values at any time. Map Interface has so many methods. Some of them are given below :- clear() : It clears all pairs from the given map....

double colon(::) operator in Java 8

In Java 8 we can also use double colon(::) as the method reference. By using double colon(::) operator we can easily convert normal method into lambda expression. The below example will show you how you will convert normal method into lambda ...

PermGen limit in JDK 8

In Java 8 The concept of Permanent Generation (PermGen) space is removed and it replaced by a new space called Metaspace. The drawback of PermGen removal is that the PermSize and MaxPermSize JVM arguments are ignored and you will never get a java...

JDBC/ODBC alternative in Java 8

The JDBC/ODBC driver is the type 1 driver it is also known as JDBC-ODBC bridge. It is ODBC driver to connect the database that convert the JDBC calls to ODBC function calls. Type 1 driver is fully platform dependent and use the native libraries o...

Difference between final and effectively final

Find the difference between final and effectively final as below: Final:- Any variable that cannot be modified once it is initialized can be final variable. You cannot modified again that variable. Ex: final int var=20; in the above e...

Interface with default methods vs Abstract class in Java 8

Interface with default methods in Java 8 In later version of Java Interfaces always contained only method declaration. We are not giving method definition in the interfaces because java did not allow multiple inheritance of classes. But in Jav...

Java 8 Iterable.forEach() vs foreach loop

foreach loop In Jdk 1.5 generics concept can be introduced and do some enhancement in for loop and the enhanced for-loop is introduced. The enhanced for-loop is reduce the overhead to print the values of the arrays and collections because it w...

Java Interview Coding problems for Freshers- Part I

Hi, For all the final year graduates and freshers, I have got a series of java coding interview questions and answers, which is good to prepare before appearing on any Java interviews. Java coding questions are based on programming, logical an...

Image Crop Using Java and Jquery Crop (Jcrop)

FrontEnd: Include jquery.Jcrop.css, jquery.Jcrop.js and jquery.Jcrop.min.js Open an image in a div with a form. Take 4 hidden input fields: <input type="hidden" id="x" name="x" /> // x coordinate of the image <input type="hidde...

How to create threads in Java?

How to create threads in Java? From main thread we can create our own user defined threads, we can create threads in two ways: By extending thread class. By implementing run-able interface. By extending thread class Create a clas...

Threads in Java

Thread Thread is a individual program execution path. Each thread has different stack, threads share some memory space. Performing multiple task parallely is known as multitasking and it is achieved by developing multi threaded application....

Method Overloading in Java

Method Overloading Creating a multiple methods with same name and with different argument list is known as method overloading. When we are overloading a method argument, list should be unique i.e, it should be unique with either number of a...

Access Specifiers

Access Specifiers Access specifiers are used to set the visibility(scope) for class or interface or members. There are following access specifiers: Private. Default/friendly. Protected. Public. Private (i) Private members ar...

Encapsulation

Encapsulation Encapsulation is defined as the process of combining the data and functions into one entity, encapsulation is a concept of making fields private and allow the access through public methods. As we are making field private so it...

Binding

Binding Connecting two or more separate methods together is known as binding. In Java there are two types of binding: 1. Early binding. 2. Late binding. Early Binding The binding which takes place at compile time is called early bi...

Components of Java Programing

Components of Java Programing The Java programming contains the following components: Keywords. Identifiers. Operators. Literals. Keywords Keywords are the commands used in Java program, these are the reserved words. In Java a...

Java Execution/Development Process

Java Execution/Development Process Java is a platform independent language. There are three stages involved in Java execution/development process: Development. Compilation. Execution. Development We write Java program in an e...

How to create Concatenate string in java

With the help of java, I have created concat() string method. In the example given below, I have used '+' operator , StringBuilder and StringBuffer Class to join string in java. The string concat() method combines specified string at the end of t...

ANT

What is ANT ? Ant is a product of Apache. Ant is a tool, based on Java library and command lines. The main motive of ant tool is that it handle the method or process which are mentioned in the build files in form of targets and extension poin...

Spring Security:RESTful Authentication via Spring

AuthenticationTokenProcessingFilter First we need to make security context where we define our Authentication Entry point and a filter for processing the token. Configuration xml will look something like this: <security:http realm="Authe...

Spring @PropertySource Annotation

Spring @PropertySource Example : Spring is a powerful framework, having almost everything a developer need to develop an application. Today we are going to talk about the @PropertySource annotation. Suppose we have a property file and we want to ...

Create JPanel in java with example

JPanel is class of swing package in java and swing package part of j2se to develop standalone application. JPanel is a container and component of the JFrame. Constructor & Description 1. JPanel() Creates a JPanel with a dou...

Create JFrame in java with example

JFrame is class of swing package in java and swing package is a part of j2se to develop standalone application. Here below I am Creating a frame with single argument constructor of the JFrame where I have declared the title of the f...

How main method internally executed by JVM ?

Hi friends, As we know that , if we declare user define method as static, then there is no need to create object of class. We can call method with the help of class name. Syntax for calling the static method: CLASSNAME.METHODNAME(). Sim...

How to split a String

Below I have written a code to split a string. Suppose we have a string name imagePath and we are going to split by "/" by using split method in java. String delimiter = "/"; String[] img; if (imagePath.contains("/")) { img = i...

Struts2 Framework and Features

Introduction of Struts2 Framework: Struts2 is one of the mostly used framework for the Java application development. The struts2 framework is developed by the Craig McClanahan and later he handed it over to the Apache Foundation. Struts2 is ba...
1 8 13
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: