try-catch Vs throws in java | Learn Coding

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 27

  • @ashishtayade047
    @ashishtayade047 10 місяців тому

    Thank you sir very nice gide & very nice best information try catch and throws block exception in java teaching video.👍

  • @mridulsd2023
    @mridulsd2023 5 місяців тому +2

    11:44 lakin sir agar hamko loop ka output chaiye toh fir toh throws ka use krne na warna trycatch me toh bas catch ko print krdega

  • @samartajshaikh2601
    @samartajshaikh2601 Рік тому

    that's a really nice analysis video 👍

  • @peacestation1462
    @peacestation1462 3 місяці тому

    thaank you bhai

  • @somrajyadav2446
    @somrajyadav2446 Рік тому

    Thanks a lot sir!!

  • @Harsh10101
    @Harsh10101 10 місяців тому

    Plz make video on java collection and advance java. #learncoding

  • @davidbutler2391
    @davidbutler2391 2 роки тому +1

    class Thro{
    public static void main(String[] args)throws ArithmeticException {
    Th.m1();

    }
    }
    class Th{
    public static void m1()throws ArithmeticException{
    // try{

    m2(10,0);
    // }
    // catch(ArithmeticException e){
    // System.out.println("Exception handled");
    //}


    }
    public static void m2(int a,int b)throws ArithmeticException{
    int c=a/b;
    if(b==0){
    throw new ArithmeticException();
    }
    else{
    System.out.println(c);

    }
    }
    }
    How to handle the above code without using try-catch block ??

    • @akhilreddy3434
      @akhilreddy3434 Рік тому

      simple...use throw keyword but best approach Is try-catch

  • @nehakumarikushwaha1866
    @nehakumarikushwaha1866 3 роки тому

    Thanks again sir

  • @hemantkhode1129
    @hemantkhode1129 3 роки тому

    Ol

  • @LearnwithsumitScience
    @LearnwithsumitScience 3 роки тому

    🙏

  • @tejaswadalkar2252
    @tejaswadalkar2252 8 місяців тому

    Sir plz reply mujhe ye samaj nahi aaya ki jab Thread.sleep(1000) likha tha aur program correct tha to ye interrupted exception kyu aaya aapne program ka aim tha 1 to 10 print ho 1 second ke aantaral me
    Aur interrupted exception ka matlab kya hota hain
    * aur sir aapne first program me Thread classs ka sleep method use Kiya vo to ekdam correct tha to exception aaya hi kyu ****
    Thodi aasan bhasha me samjaye sir
    Plz reply sir meri exam pas hain sir

  • @sadhanasoni8257
    @sadhanasoni8257 3 роки тому +1

    Sir aap DS. me tree and graph pr v video bna dijiye. Pls sir.....

  • @aayush_verma223
    @aayush_verma223 3 роки тому

    SIR YOUR TEACHING STYLE IS VERY GOOD
    SIR WHERE ARE YOU FROM

  • @roniacharjee7269
    @roniacharjee7269 3 роки тому

    tnx .... Your lecture was supper ... you need to be teacher for the nation

  • @mr_adarsh_pandit
    @mr_adarsh_pandit 3 роки тому

    Bhai mai apka sabhi video dekhta hu
    Aur first comment bhee karta hu but aaap javab kyu nahi dete

  • @muskangupta8299
    @muskangupta8299 3 роки тому

    Yaha wait method ka Object kyu nhi create kiya gya. Direct usse likh kyu diya gya

  • @MrNKC-hv7dd
    @MrNKC-hv7dd 3 роки тому

    bro plz one request 🙏 😔 I have a exam plzz tell about attribute nd also about what is key nd types of key plzz bro 🙏

  • @pathanboss613
    @pathanboss613 3 роки тому

    Sir is program me try block ke andar 2 exception thi interrupted and arithmetic exception interrupted ko Throw kr catch ko diya catch ne solve kiya .....kya iske baad Arithmetic exception ko Dobara se solve kiya gaya yaa use ignorred kiya gaya yahi doubts hai sir ?.....

  • @meghalijagtap9630
    @meghalijagtap9630 3 роки тому

    can we give like this in main declaration
    throws InterrruptedException, ArithmeticException

    • @LearnCodingOfficial
      @LearnCodingOfficial  3 роки тому

      Yes, you can.
      In this playlist all types of exception like InterruptedException 👇👇👇
      ua-cam.com/play/PLqleLpAMfxGAEfyXJyF-9UOs9C8dmir_Y.html

  • @mr_adarsh_pandit
    @mr_adarsh_pandit 3 роки тому

    Bhai apka whatsapp number chahiye tha kuch kaam tha

  • @surajkumar-jm3mi
    @surajkumar-jm3mi Рік тому

    🙏