Java 8 – Lambda Expression example

Java 8 – Lambda Expression example

Lambda Expression Lambda expression is a new feature in Java 8 . Alternative to anonymous class implementation of interfaces ( with single abstract method ). syntax : (parameters) -> { body of statements } Example – Sorting the list of Employees using...
Java – Try vs Try-with-Resources

Java – Try vs Try-with-Resources

JDK 7 comes with try-with-resources feature which allows automatic closing of resources without explicit finally block leading to minimal code and avoids boilerplate code required for closing of resources…

Java Custom Annotations – Read using Reflection API

Java Custom Annotations – Read using Reflection API

After reading this article , you will be able to create an Annotation in Java and Read the annotations using Java Reflection API. Java Annotations can be created as follows : @Retention(RetentionPolicy.RUNTIME) // makes the annotation available at runtime and can be...
Java Reflection API Example – Method Invocation

Java Reflection API Example – Method Invocation

Java Reflection API : Java Reflection API is a powerfull and advanced API ( part of JRE ) , which can be used to deal with Java Classes at runtime rather than at compile time. Realtime Usages : 1) Spring uses Reflection API for dependency injection . 2) JUnit...
How to Run Commands in Java

How to Run Commands in Java

Commands can be run in Java using either of the following ways : i) Using Runtime.getRuntime().exec(String) or Runtime.getRuntime().exec(String[]) ii) ProcessBuilder Lets see some examples using first way. Run single command ‘dir’ package com.demo; import...
SQL Injection Attacks – Prevention

SQL Injection Attacks – Prevention

What is SQL Injection attack ? SQL Injection attack happens through passing the malicious data as input ( such as username , password containing ILLEGAL QUERIES OR STRINGS in the form submission in a page ) from client to server , which can lead to problems such as...
Maven Tutorial in 7 Minutes

Maven Tutorial in 7 Minutes

Maven is a project management tool which makes it easy to manage : -> Builds -> Dependencies -> Documentation -> Reporting -> Releases -> Distribution etc Before moving further , lets look at some terminology used in Maven. Maven Terminology Project...
www.000webhost.com