We can write abstract class with all unimplemented methods like interface...
Then can we replace interface with abstract class, if not why ?
Java Library
Contact information, map and directions, contact form, opening hours, services, ratings, photos, videos and announcements from Java Library, Library, sathupally, Hyderabad.
Java Library is the page for learning and sharing our experience in real time scenario,how those problems we solved.its helps to all who learning and working java related languages.
10/04/2020
Free Udemy Courses :
1. Create Wordpress Website : Code FORFRIENDS
Link : https://bit.ly/2XnGvH0
2. Complete Angular Masterclass : Code C809A62851395EABAE7A
Link : https://bit.ly/2UTYljj
3. Learn Java : Code JAVA_BASICS_FREE3
Link : https://bit.ly/3c7GR8D
10/04/2020
Free Course :
Complete Python 3 Course.
Use Code 43ABBC183C3A7E38B840
Link :
09/07/2019
https://howtodoinjava.com/java8/lambda-expressions/
Java 8 lambda expressions - Java lambda example - HowToDoInJava In programming, a Lambda expression (or function) is just an anonymous function, i.e., a function with no name and without being bound to an identifier. In other words, lambda expressions are nameless functions given as constant values, and written exactly in the place where it's needed, typically a...
JAVA 8 new Feature Lambda expressions
------------------------------------------------------
A lambda is a function
Until java 8, function could only be implemented using methods,
A lambda enables function to be passed around
Lambda expression adds that missing link of functional programming to Java.
Lambda expressions helps to write very simple code
Especially useful in places where a method is being used only once, and the method definition is short.
It saves you the effort of declaring and writing a separate method to the containing class.
How lambda works with Example
------------------------------
1) Normal implementaion of an interface
-------------------------------------------------
interface FirstLambda{
public void sayHello();
}
class LambdaImpl implements FirstLambda{
public void sayHello() {
System.out.println("Welcome to Lambda Example");
}
}
public class LambdaMain {
public static void main(String[] args) {
FirstLambda inst=new LambdaImpl();
invoke(inst);
}
public static void invoke(FirstLambda inst){
inst.sayHello();
}
}
2) We can implement this by using annonamus class implimentation
----------------------------------------------
interface FirstLambda{
public void sayHello();
}
public class LambdaMain {
public static void main(String[] args) {
FirstLambda inst=new FirstLambda(){
public void sayHello() {
System.out.println("Welcome to Lambda Example");
}
};
invoke(inst);
}
public static void invoke(FirstLambda inst){
inst.sayHello();
}
}
3)By using lambda expression
--------------------------------------
interface FirstLambda{
public void sayHello();
}
public class LambdaMain {
public static void main(String[] args) {
FirstLambda inst=() -> System.out.println("Welcome to Lambda Example");
invoke(inst);
};
public static void invoke(FirstLambda inst){
inst.sayHello();
}
}
Assume......Think...
java class == our house Enviroment
in our house we contain no of things like
plates,bowls,glasses,windows,doors,key loker,cycle,bike,car...etc
father,mother,brother,sister,grand fathr,grand mother....etc
as well as in class
variables,methods,method parameters,static variables,access modifiers (public ,private..)
here.....
class{ class is home and { & } compound wall of house
}
if you have friend ,he comes to your house with or without your/gate keeper permission i.e access /or not access
unkown person before coming in to your house ,he should permit from you ....so what here i am saying is
i wann going in to class ,jre(java runtime environment) checks is this class is public or private
example:
public class ABC {
}
//this class will be access your friend/ any unkown person
private class ABC {
}
// no one can not access this class
as well as
public class ABC {
private String name;
// this is variable declaration {String is the declaration data type is group of charecters ex: java is string
here i assign name is java.
//And this is declare as private we can't this variable
name="JAVA";
puclic setName(String name){
this.name=name;
}
public String getName(){
return this.name;
}
public static void main(String args[]){
ABC abc=new ABC(); this is instance creation ,and this instance is refferce to abc
abc.name; compile error
System.out.print("we cant access the abc.name value.."+abc.name);
abc.getName(); // now we can get name
}
}
// home is public like class... but bike is private variable like name think in this way....ok
person
in real life if you want to use friends bike....
1st you should get permission from your friend as well as we use getName() method
Think in this way practically.....
IF you really like and understood like and share it.. :) :) :)
PC Register(Program Counter):It will contains the address of next instruction that has to be executed.
JavaStack:it can be used storing the information about methods,under execution,this can be consider as the combination of stack frames every frame contains the state of a single method
Heap Area:it can be used for storing the Objects that are created
Method Area:This can be used for storing the class code and method code.
Byte code will be located in different areas at run time.
Click here to claim your Sponsored Listing.
Location
Category
Telephone
Website
Address
Sathupally
Hyderabad
