காட்டு
0:03
S… Speaker 1 (3- Anonymous Inner Classes)
So in the last video we passed a new instance of our console printer
0:07
S… Speaker 1 (3- Anonymous Inner Classes)
class to a Greek method As I told you sometimes we don't want to explicitly
0:11
S… Speaker 1 (3- Anonymous Inner Classes)
create a class to implement an interface Perhaps we want to implement an
0:15
S… Speaker 1 (3- Anonymous Inner Classes)
interface only once and use it for a single purpose We don't want to reuse
0:19
S… Speaker 1 (3- Anonymous Inner Classes)
that class.
0:20
S… Speaker 1 (3- Anonymous Inner Classes)
So that's where we use anonymous inner classes So
0:25
S… Speaker 1 (3- Anonymous Inner Classes)
instead of creating a new instance of the console printer class here
0:29
S… Speaker 1 (3- Anonymous Inner Classes)
we can type new
0:31
S… Speaker 2 (3- Anonymous Inner Classes)
printer.
0:31
S… Speaker 1 (3- Anonymous Inner Classes)
So we type the name of the interface and press enter.
0:34
S… Speaker 1 (3- Anonymous Inner Classes)
What we have here is called an anonymous inner
0:38
S… Speaker 1 (3- Anonymous Inner Classes)
class.
0:39
S… Speaker 1 (3- Anonymous Inner Classes)
It's anonymous because this class doesn't have a name.
0:42
S… Speaker 1 (3- Anonymous Inner Classes)
It's just an implementation and we call it an inner class because we're
0:46
S… Speaker 1 (3- Anonymous Inner Classes)
using this inside a method.
0:48
S… Speaker 1 (3- Anonymous Inner Classes)
Okay, so in this class we're
0:52
S… Speaker 1 (3- Anonymous Inner Classes)
implementing the print method.
0:53
S… Speaker 1 (3- Anonymous Inner Classes)
Here we can use a print statement to print this
0:58
S… Speaker 1 (3- Anonymous Inner Classes)
message.
0:58
S… Speaker 1 (3- Anonymous Inner Classes)
Now when we run this program
1:02
S… Speaker 1 (3- Anonymous Inner Classes)
we get the exact same result.
1:03
S… Speaker 1 (3- Anonymous Inner Classes)
So this is how we can use an anonymous inner class.
1:07
S… Speaker 1 (3- Anonymous Inner Classes)
With anonymous inner classes,
1:09
S… Speaker 1 (3- Anonymous Inner Classes)
we can achieve the same result by writing less code.
1:12
S… Speaker 1 (3- Anonymous Inner Classes)
But Java 8 introduced a better and more concise way to achieve
1:16
S… Speaker 1 (3- Anonymous Inner Classes)
the same result.
1:17
S… Speaker 1 (3- Anonymous Inner Classes)
That's called a lambda expression and we're going to look at that next.

இந்த ஒலிப்பதிவு AI (தானியங்கி பேச்சு அடையாளம்) மூலம் உருவாக்கப்பட்டது. பிழைகள் இருக்கலாம் - முக்கியமான பயன்பாட்டுக்கு மூல ஒலியை சரிபார்க்கவும். AI கொள்கை

❤️ STT.ai ஐ நேசிக்கிறீர்களா? உங்கள் நண்பர்களுக்குச் சொல்லுங்கள்!
சுருக்கம்
இந்த நகலெடுப்புக்கான AI சுருக்கத்தை உருவாக்க சுருக்கம் என்பதை க்ளிக் செய்யவும்.
சுருக்கப்படுகிறது...
இந்த நகலை AI க்குக் கேட்கவும்
இந்த நூலைப் பற்றி ஏதாவது கேட்கவும் - AI தொடர்புடைய பகுதிகளைக் கண்டுபிடித்து பதிலளிக்கும்.