Check out our courses: Java Spring Boot AI Live Course: Coupon: TELUSKO20 (20% Discount) AI Powered DevOps with AWS - Live Course :- Coupon: TELUSKO20 (20% Discount) Master Java Spring Development : Coupon: TELUSKO20 (20% Discount) For More Queries WhatsApp or Call on : +919008963671 website : Udemy Courses: Spring: Java:- Java Spring:- Java For Programmers:- Python : Git : Docker : Instagram : Linkedin : TELUSKO Android App : TELUSKO IOS App : Discord : 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(){ ("In A"); } public void display(){ ("In A"); } } class B extends A{ @Override public void show(){ ("In B"); } /* @Override public void displayData(){ ("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 : More Learning : Java :- Python :- Django :- JavaScript :- Node JS :- Rest Api :- Servlet :- Spring Framework :- Design Patterns in Java :- Docker :- Blockchain Tutorial :- Corda Tutorial:- Hyperledger Fabric :- NoSQL Tutorial :- Mysql Tutorial :- Data Structures using Java :- Git Tutorial :- Donation: PayPal Id : navinreddy20









