- JAVA OVERVIEW
- History of Java
- Tools you will need for java
- Java Environment Setup
- Popular Java Editors
- Java Basic Syntax/First-Program
- Java Identifiers
- Java Modifiers
- Java Arrays
- Java Enums
- Java Keywords
- Comments in Java
- Java - Objects and Classes
- Objects in Java
- Classes in Java
- Constructors
- Creating an Object
- Accessing Instance Variables and Methods
- Source file declaration rules
- Java Package
- Simple Case Study
- Basic Data Types
- Primitive Data Types
- Reference Data Types
- Java Literals
- Variable Types
- Local variables
- Instance variables
- Class or static variables
- Java Access Modifiers
- What is OOPS
- Inheritance concept
- Encapsulation
- What is Polymorphism
- Method Overloading
- Method Overriding
- Abstraction in Java
- Abstract class
- Interface in Java
- Method overloading in Java:
- What is Annonymous object?
- Java 8
Java 8
Java 8 introduces in 18th march 2014, It comes for concise the code with the help of functional programming. the new features in java 8 are:-
Lambda expressions:-
We can use functional programming with the help of Lambda expressions it is very easy to use.
It implements a specific interface called functional interface.
Lambda expressions is a function that does not have any name,return type and modifer or it is a nameless function so we called Lambda expressions is an Anonymous function.
A function that can be created without belonging to any class.
Syntax of lambda expression-
(parameters) -> function body;
Code Without Lambda Expression to print Hello world
public class Test
{
public static void main(String args[])
{
System.out.println("Hello World..");
}
}
Code With Lambda Expression to print Hello world
import java.util.function.*;
interface HelloWorldLambdaExpression
{
void print();
}
public class HelloWorld
{
public static void main(String[] args)
{
HelloWorldLambdaExpression obj=()->{System.out.println("Hello World...");}; // lambda expression to define the calculate method
obj.print(); // parameter passed and return type must be same
}
}
Code Without Lambda Expression to print Addition value
public class Test
{
public static void main(String args[])
{
int a=10,b=20;
System.out.println(a+b);
}
}
Code Witht Lambda Expression to print Addition value
import java.util.function.*;
interface Sum
{
int sumCalculation(int a, int b);
}
public class ExampleOfFunctionalInterfaceAnnotation
{
public static void main(String[] args)
{
int m=10; int n=20;
Sum sum=(int a, int b)->a+b; // lambda expression to define the calculate method
int result=sum.sumCalculation(m, n); // parameter passed and return type must be same
System.out.println("Result: "+result);
}
}