#71 What is Annotation in Java
HTML-код
- Опубликовано: 30 июн 2024
- Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-spring-cloud
Udemy Courses:
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
Java For Programmers:- bit.ly/javaProgrammers
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
In this lecture we are discussing:
#1 What is Annotations?
#2 What does annotations provide to program?
#3 How annotation prevent us from logical error?
1)
What is Annotations?
-- annotation is type of comment which is used to provide meta data to the compiler and JVM about the program.
Basic difference between comment and annotations
-- annotation is used to provide meta data to the compiler and JVM about the program but comment is used to provide information to the programmer.
2)
What does annotations provide to program and what does for program?
-- Annotations are used to provide supplemental information about a program.
-- Annotations start with ‘@’.
-- Annotations do not change the action of a compiled program.
-- Annotations help to associate metadata (information) to the program elements i.e. instance variables, constructors, methods, classes, etc.
-- Annotations are not pure comments as they can change the way a program is treated by the compiler. See below code for example.
3)
How annotation prevent us from logical error?
class A{
public void show(){
System.out.println("In A");
}
public void display(){
System.out.println("In A");
}
}
class B extends A{
@Override
public void show(){
System.out.println("In B");
}
/* @Override
public void displayData(){
System.out.println("In B");
}
*/
//here you get error because you are not overriding the method of parent class but you are using @Override annotation
// if you are thinking I can override display() method but you should defined new method but whenever you mention @override compiler throw error that you are not override the parent class method
//it helps to avoid the logical error in the program because logical error is more difficult to find when you use annotation it helps to find the logical error
//because solving problem at compile time error is easy than solving problem at runtime
}
Github repo : github.com/navinreddy20/Javac...
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com Наука
Good information. It's going to take me a while to watch all your new lessons. Thanks for sharing.
Best of all! I appreciate your great help to thousands of learners out there with such effective content... A Big Thanks Sir
One of the best teacher and good human out there!
Very Nice Explanation. Thanks
[00:00](ruclips.net/video/1xuDEPftKV0/видео.html) Annotations in Java provide metadata or extra information to the compiler or runtime, aiding in code interaction without changing functionality.
[02:33](ruclips.net/video/1xuDEPftKV0/видео.html) Logical problems in programming, known as bugs, can arise when expectations differ from outcomes, emphasizing the importance of debugging.
[04:00](ruclips.net/video/1xuDEPftKV0/видео.html) Annotations, like "@Override," enable developers to indicate intentions to the compiler, facilitating early error detection and debugging at compile time.
[05:22](ruclips.net/video/1xuDEPftKV0/видео.html) Annotations play a significant role in frameworks like Hibernate and Spring, offering various annotations for methods, variables, and classes to enhance code clarity and functionality.
[06:46](ruclips.net/video/1xuDEPftKV0/видео.html) Developers can specify the retention level of annotations, such as compile-time or runtime, to determine their applicability beyond compilation, particularly useful in frameworks.
Great video
Great video 🤠🙌🏼
superb explaination
Thanks
My brain almost fix when we type long methods they gets into a bug 😂😂even they are right. Loll..
Thanks mann
thankss sir now i understoood agter searching 10 times on web loll
working in programming from almost 8 years writting code, had no idea this thing exists
Thanks for sharing. But this does not explain what annotations are in themselves. What are they? How do they behave behind the scene? Are they classes? Are they interfaces?
Which ide is this?
Visual Studio Code
this is not a bug the two method names are different. u missed "s" in Belongs in class B
That's a bug...human errors including misspellings cause bugs. That was his point.
I was saying the same, S is missing in belongs
so twist is 's'😅
3:25😂
methods name different
Haha..I almost write the comment that there is no method overriding.....hence calling the method of class A will call the method A same goes for class B.
These mistake is common specially when you working with many classes were annotation helps a lot!!