Java 8 New Features || Method() and Constructor Reference || by Durga Sir

preview_player
Показать описание
Oracle Java Certification: Shortest Way To Crack OCA 1Z0-808 Just @ Rs 640/-

1. For Java SE 8 Programmer I Exam
2. Topic wise Tests and Grand Tests
3. 280 Realistic Questions With Clear Explanation
4. Study Material (408 Pages)
5. Question Bank (107 Pages)
6. Videos (63 Sessions)

Use the below links to access Durga Sir Videos and Downloadable Materials and Topic wise Tests and Grand Tests with Life-Time Access.

1. Oracle Java Certification: Shortest Way To Crack OCA 1Z0-808

2. Java 8 New Features In Simple Way

3. Java 9 New Features In Simple Way: JShell, JPMS and More

4. Complete JDBC Programming Part-1

5. Complete JDBC Programming Part-2

For More Info:
DURGASOFT Online Team
Ph:8885252627,7207212427/28
Рекомендации по теме
Комментарии
Автор

This is just for your reference friends.
please watch complete video you will learn lot of things.the way Durga sir explain is amazing.

1. Method and constructor reference are alternative to lambda expression.​
2. Main advantage of using these is code re usability.​
3. we can refer any method with class_name followed by double colon(::) then method name.​
Example : Test::m1();​
4.(**) : Functional interface methods can be mapped to our specified method by using :: operator, this is called method reference.​
5. to call non-static (instance) method we can use object reference instead of class name ​
Syntax : Test t = new Test();​
t::method_name​
6.if you have any existing method then go for method reference instead of writing lambda expression.​
Rule(**) : while using MR make sure that method argument must be same.

When we can use CR ?​
When FI method return object then we should go for CR.​
Syntax : class_name::new​
1 ) With CR you can refer FI method with class constructor.​


hemantkumar-clyp
Автор

Best things in the world are free...And so these java tutorial...thanks a lot

kamalmukhija
Автор

Sir you are Java god for me, your channel is simply a gold mine.
Lots of love, Thanks for sharing all these stuffs.

mukeshvishwakarma
Автор

This series really helped me a lot to learn Java8 Sir made the concepts extremely easy...Thanks a lot... :)

rishikesharora
Автор

Thank you sir for this Java 8 series.
I used to feel this one as difficult concept
Hence never used. But after going through this series I got full confidence.
This one is really helpful .... Always stay safe and healthy sir....

zenith
Автор

There are only 2 GOD's Of Java In India & Maybe Whole World. One is Ramesh Sr From LARA Tech Banglore & Other Is DURGA Sr From DurgaSoftwareSolution Hydrabad. Thanks For The Multiverse GOD Sri Hari Vishnu - He Inspired One Of The GOD To Give Free Education On Youtube...Feeling Blessesd.

shubhamagarwal
Автор

Hi sir! Arguments types must be matched in method reference. But in the below e.g. even though arguments type are note same, code is executing fine. (see e.g. below)


public interface Interf {
public void add(int x, int y);
}


public class Test {

private void sum (int m, long n)
{
System.out.println("Sum : " + (m+n));
}

public static void main(String[] args) {

Test t = new Test();
Interf i1 = t::sum;
i1.add(100, 200);

}

}

AvinashKumarBarnwalKol
Автор

East or West Durga software is the best thank you so much sir plz sir upload more video just like java 9, 10, 11, 12, 13 plz sir upload all java feature plz plz plz💓💓💓💓🙏🙏🙏🙏🙏🙏🙏🙏🙏

springmasti
Автор

Hello Sir, your explanation is so simple so that anyone can understand easily, just started to watch your vidoes. I never understood generics clearly but from your tutorials now i got more confidence in generics. Also waiting for your Javascript Nashorn videos. Cant't thank you enough.

srikanthd
Автор

After watching this video I made one conclusion:
JAVA IS NO LONGER JAVA.

sarangkumar
Автор

Kindly do videos on streams, optionals and filters

jeganmuthu
Автор

Thank you so much sir for this videos. Appreciate if you upload videos for Streams concept as well.

FakhruddinKararawala
Автор

Noo i checked it..Return type checking is also must in method reference.. It also must be same..

Itisme
Автор

Thank you so much for this series of videos. It helped me alot to understand.

esmailpaltasingh
Автор

Thank you so much durga sir for all the videos.
It will be great for us if you will upload remaining video of java 1.8 features.

bipinjaiswal
Автор

Thank you sir for the series!! Can you clear the method reference return types because its giving error when I use different return types?

jadhav
Автор

First of all thank you so much for this series. I have one small doubt-
As you said, *only restriction is argument type must be matched* ( 23:41 ). Can you tell why following code snippet working fine?
BiConsumer<ArrayList, Object> biConsumer = ArrayList::add;
ArrayList li = new ArrayList();
biConsumer.accept(li, "Tanmoy");
System.out.println(li);

tanmoyroy
Автор

Thanks a lot for the video. However you did not mention instance method of an arbitrary object which is written as static method. Coul you please explain what is the difference between " Instance methods of an arbitrary object of a particular type" and "Instance methods of particular objects"
Thanks in advance

ozgurleo
Автор

thank you very much sir for this video

saddamahmad
Автор

Sir you said that for method reference only arguments are same.. not required same return type or same access modifiers so what about this code..

public class Main {

static void add(int a, int b){
System.out.println(a+b);
//return a+b;
}

public static void main(String[] args) {
Interf i = (a, b)->a+b;
System.out.println(i.sum(3, 4));

Interf i1 = Main::add;
i1.sum(3, 4);
}
}

interface Interf{
int sum(int a, int b);
}



Output is :
Compiler error: incompatible types: bad return type in method reference
Interf i1 = Main::add;
^
void cannot be converted to int
1 error

siddhivinayak-