#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
  • НаукаНаука

Комментарии • 24

  • @guitarDad100
    @guitarDad100 Год назад +6

    Good information. It's going to take me a while to watch all your new lessons. Thanks for sharing.

  • @omdobariya7971
    @omdobariya7971 11 месяцев назад +4

    Best of all! I appreciate your great help to thousands of learners out there with such effective content... A Big Thanks Sir

  • @KarthikBhatl
    @KarthikBhatl 6 месяцев назад +3

    One of the best teacher and good human out there!

  • @jobijose5397
    @jobijose5397 Год назад +2

    Very Nice Explanation. Thanks

  • @MoeMoe-qr7od
    @MoeMoe-qr7od 5 месяцев назад +4

    [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.

  • @gideonebubechukwu7194
    @gideonebubechukwu7194 8 месяцев назад +1

    Great video

  • @samarthtandale9121
    @samarthtandale9121 Год назад +2

    Great video 🤠🙌🏼

  • @ashirwadkatkamwar5555
    @ashirwadkatkamwar5555 4 месяца назад

    superb explaination

  • @harshithagurram2880
    @harshithagurram2880 Год назад

    Thanks

  • @uday2159
    @uday2159 Год назад +2

    My brain almost fix when we type long methods they gets into a bug 😂😂even they are right. Loll..

  • @rakipalivela64
    @rakipalivela64 Год назад

    Thanks mann

  • @dhruvyadav3492
    @dhruvyadav3492 Месяц назад

    thankss sir now i understoood agter searching 10 times on web loll

  • @pakistaninsaudi
    @pakistaninsaudi 4 месяца назад

    working in programming from almost 8 years writting code, had no idea this thing exists

  • @adilwise
    @adilwise 8 месяцев назад

    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?

  • @ankurpremmasih8207
    @ankurpremmasih8207 Год назад +2

    Which ide is this?

  • @svasanth6470
    @svasanth6470 Год назад +13

    this is not a bug the two method names are different. u missed "s" in Belongs in class B

    • @seanbhrim
      @seanbhrim Год назад +5

      That's a bug...human errors including misspellings cause bugs. That was his point.

    • @aakashsinha9641
      @aakashsinha9641 Год назад

      I was saying the same, S is missing in belongs

  • @madhankumarmadhankumar3226
    @madhankumarmadhankumar3226 9 месяцев назад +1

    so twist is 's'😅

  • @richardharris202
    @richardharris202 Месяц назад

    3:25😂

  • @AbSen17
    @AbSen17 Месяц назад

    methods name different

  • @YashRajput-gj6zf
    @YashRajput-gj6zf Год назад +1

    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!!