Core Java With OCJP/SCJP: Innerclass Part- 2||normal innerclass||regular innerclass

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 139

  • @kartikeybajpai1592
    @kartikeybajpai1592 7 หลายเดือนก่อน +6

    Sir, its 2024 .. and i still watch your videos when i have to refer any java concept... You are far better than those bhaiya and didi channels teaching these languages without explaining the core concepts and fleecing students.. Sheer example of OLD IS GOLD..

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  7 หลายเดือนก่อน

      Hello Kartikeya.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

    • @kartikeybajpai1592
      @kartikeybajpai1592 7 หลายเดือนก่อน

      @@DurgaSoftwareSolutions been a subscriber since channel's inception😃

    • @ranveervaghela7030
      @ranveervaghela7030 6 หลายเดือนก่อน

      True Man!!

  • @dinkarinjosh
    @dinkarinjosh 4 ปีที่แล้ว +36

    2020 Update: Its good to understand the general concept, however questions at the end of the video, do not hold water after Java 8. As you can access the local members of the enclosing block from inside the inner class method (if they are final or effectively final). This works in Java 8 and above try yourself.
    public class Test {
    int i =10;
    static int j = 99;
    public void mi(){
    int k =100;
    final int m = 40;
    class Inner1{
    public void m2(){
    System.out.println(i +" " + j +" "+ k+ " "+ m);
    }
    }
    Inner1 i = new Inner1();
    i.m2();
    }
    public static void main(String[] args) {
    Test t = new Test();
    t.mi();
    }
    }

    • @ramansharma5014
      @ramansharma5014 4 ปีที่แล้ว +1

      correct

    • @amolthawal1746
      @amolthawal1746 4 ปีที่แล้ว +2

      Thank you bro

    • @abhiny8
      @abhiny8 3 ปีที่แล้ว

      same question came to my mind then I tried to find old java compiler online but to no avail finally confirmed with your comment ty

    • @shafaathussain6104
      @shafaathussain6104 3 ปีที่แล้ว

      Thanks bro

  • @sumitbhardwaj612
    @sumitbhardwaj612 3 ปีที่แล้ว +5

    you have the gift of maa Saraswathi. you are one of the fabulous teacher I ever seen in my life..

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  3 ปีที่แล้ว +1

      Hello Sumit.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @MrCoder-xj9yi
    @MrCoder-xj9yi 4 ปีที่แล้ว +15

    [1.8V + versions] At 1:04:00 ,we can access local variables but they need to final either explicitly of implicitly(i.e once assigned cannot change)

    • @revanthsai7894
      @revanthsai7894 3 ปีที่แล้ว +2

      Java 8 introduced the concept of effectively final. A variable that is declared and initialized and not being assigned again is considered effectively final. And the compiler allows that code without declaring the variable final.

  • @rokib_ru_cse
    @rokib_ru_cse 2 ปีที่แล้ว +2

    world best teacher is durga sir.. love from bangladesh .

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  2 ปีที่แล้ว +1

      Hello Rokib Ahmed.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @highwaylife_0.0
    @highwaylife_0.0 ปีที่แล้ว +5

    1:05:00
    After Java 8 local variable doesn't not need to declare Final explicitly , but It should be effectively final.
    Effectively Final means value of local variable should not change inside that method.

  • @vishalvikram3771
    @vishalvikram3771 4 ปีที่แล้ว +9

    To all viewrs of 2020 There is an error at 1.02 with respect to jdk version.
    Sir is explaining the concept with less then 1.8 verson that's why it will give error .But if u try to compile it in version greater then 8 it will compile. Successfully.

  • @Jasleen-jk7qo
    @Jasleen-jk7qo 6 ปีที่แล้ว +20

    Till JDK 7,Local inner class can access only final local variable of the enclosing block. However From JDK 8, it is possible to access the non-final local variable of enclosing block in local inner class.

    • @oibook
      @oibook 6 ปีที่แล้ว +2

      ohh! i was wondering how the same example is working on my pc and not in the video. thanks for clarification.

    • @renjithr7676
      @renjithr7676 6 ปีที่แล้ว +4

      The answer is wrong. Still local variable has to be final, but you are not required to explicitly define it. If you are trying to change the value, compiler will inform you an error in your declaration that - 'Variable 'i' accessed from within inner class, needs to be final or effectively final'

    • @sachinmisurkar7209
      @sachinmisurkar7209 5 ปีที่แล้ว +3

      in Java8 they made it final internally , so if you declared it as final or not , they are effectively final , thats the reason we can access it in java 8 without marking variable as final

    • @niteshtak8484
      @niteshtak8484 5 ปีที่แล้ว

      thx for sharing

    • @venkateswarareddyvemireddy4369
      @venkateswarareddyvemireddy4369 4 ปีที่แล้ว

      There is a possibility to modify value of variable before inner class declaration.

  • @ranveervaghela7030
    @ranveervaghela7030 2 หลายเดือนก่อน +3

    Again completed watching on sept 02, 2024 at 10.10 PM :)

  • @sureshkumarmahalingam1096
    @sureshkumarmahalingam1096 5 ปีที่แล้ว +4

    master of java means Durga Sir only

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  5 ปีที่แล้ว

      Hello Suresh.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @tharunkumar8430
    @tharunkumar8430 7 หลายเดือนก่อน +3

    1:23:36 static method inside inner class is valied from java 8 onwards. Beginners plz cross check this point.

  • @phgraviyt3650
    @phgraviyt3650 9 ชั่วโมงที่ผ่านมา +1

    Very nice explanation but after java 1 . 8 version onwards we are not required to declare local variable as final to access them inside the inner class Or inner class method
    Just keep them effectively final nothing else u can take final also no problem but it's not required
    Just keep in mind don't modify that variable inside the inner class otherwise u will get compile time error
    Saying : local variables referenced from an inner class must be final or effectively final

  • @shalendrakumar-xv5pp
    @shalendrakumar-xv5pp ปีที่แล้ว +1

    Your teaching style is amazing

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  ปีที่แล้ว

      Hello Friend.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @utsavmodh9698
    @utsavmodh9698 8 หลายเดือนก่อน +2

    excellent concept explanation 🎉

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  8 หลายเดือนก่อน

      Hello utsav.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @Dhiraj-nd9vy
    @Dhiraj-nd9vy ปีที่แล้ว +1

    In earlier versions of Java, within a non-static nested (inner) class, you couldn't declare static members, methods, or fields directly. However, since Java 8, static methods and fields are allowed within a nested (inner) class if they are declared with the static keyword.

  • @edeepakjain
    @edeepakjain 5 ปีที่แล้ว +1

    Best videos... Covers everything 👌👌👌

  • @AbdullahAlMamun-fh9gs
    @AbdullahAlMamun-fh9gs 4 ปีที่แล้ว +3

    Java means Durga Sir. Love you a lot sir

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  4 ปีที่แล้ว

      Hello Al Mamun.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @eadunuripranay5977
    @eadunuripranay5977 4 ปีที่แล้ว +5

    Hi durga sir,
    Regarding Method local inner classes:
    -------------------------------------------------------------
    from 1.8V, we can access the local variable of the method in which inner class has been declared from the inner class. So the concept explained at 1:14:00 was brilliant but how come itz working from 1.8V may i know based on what functionality the local variable is being accepted?

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  4 ปีที่แล้ว

      Hello Pranay.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @hamidulla512
    @hamidulla512 หลายเดือนก่อน

    method local inner class can also access "effectively final" local variables.
    effectively final meaning:
    1) variable without final keyword
    2) initialized or assigned value only once.

  • @sourjadhar9332
    @sourjadhar9332 ปีที่แล้ว +1

    i think in latest version of jdk we can make a methods of method local inner class static,it will not throw any error

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  ปีที่แล้ว

      Hello Friend.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @shrutibansal860
    @shrutibansal860 2 ปีที่แล้ว +1

    sir, thankyou for lectures, they are very useful. My doubt is :- Method local Inner class purpose is :to reuse the same functionality of method again then why can't method variable be accessed from within the inner class?

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  2 ปีที่แล้ว

      Hello Shruthi.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @ranveervaghela7030
    @ranveervaghela7030 6 หลายเดือนก่อน +2

    Completed watching on 29-05-2024 at 3.30 PM

  • @aamirali8114
    @aamirali8114 3 ปีที่แล้ว +4

    1:05:00 program of calling local variable in Inner class I didnt got any error. Code worked fine without using final keyword.

  • @v.r.499
    @v.r.499 6 ปีที่แล้ว

    @DurgaSoftwareSolutions Time.Seek( 1:12:30 )
    1.) Reference of inner class also gone when instance method(m1) gone from stack.
    2.) when we call m2 method from m1 then m1 is also on stack as well as m2 is on stack, then is it possible to access m1 method variable inside m2 method (when can we access local variables of one method from other method, if both methods are available on stack) ??

  • @DeepakKumar-dw1re
    @DeepakKumar-dw1re 2 ปีที่แล้ว +1

    Thanks durga Sir🙏

  • @Lasaacademy
    @Lasaacademy 3 ปีที่แล้ว +2

    Compiler will give left on right
    Very decently😀😀

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  3 ปีที่แล้ว +1

      Hello Friend.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

    • @Lasaacademy
      @Lasaacademy 3 ปีที่แล้ว +1

      I am watching your videos
      Impressed a lot..
      I want to learn advanced java also
      Please help me so,
      How to contact

  • @deepakgupta1843
    @deepakgupta1843 5 ปีที่แล้ว +1

    Superb

  • @jamesshamamala
    @jamesshamamala 5 ปีที่แล้ว +2

    Dear sir,
    I have come across you video, i have small doubt regarding below point
    From method local inner class, we can’t access local variables of the method in which we declare inner class
    but i am able to access the variable
    Please find the code below
    public class DiffeentlevelsOfVariable {
    int i = 0;
    static int j = 20;
    public void m1() {
    int k = 30;
    final int m = 40;
    class Inner {
    public void m2() {
    System.out.println("i Value:"+i);
    System.out.println("j Value:"+j);
    System.out.println("k Value:"+k);
    System.out.println("m Value:"+m);
    }
    }
    Inner i = new Inner();
    i.m2();
    }
    public static void main(String[] args) {
    DiffeentlevelsOfVariable obj=new DiffeentlevelsOfVariable();
    obj.m1();
    }
    }
    Output:
    i Value:0
    j Value:20
    k Value:30
    m Value:40
    Successfully i am able to execute the above without having any issues

    • @manisurya9253
      @manisurya9253 4 ปีที่แล้ว

      Yes..we can access..

    • @gavravdhongadi9824
      @gavravdhongadi9824 4 ปีที่แล้ว

      That is because of you are probably using Java 8 or above version

  • @Lakshmankablog
    @Lakshmankablog 2 ปีที่แล้ว +1

    👏👌🥳

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  2 ปีที่แล้ว

      Hello lakshman.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @sunnymaurya4633
    @sunnymaurya4633 6 ปีที่แล้ว +1

    Sir please update or make a reference in this video From jdk 1.8 version we can access local variable inside inner class

  • @rizwanshahid1447
    @rizwanshahid1447 7 ปีที่แล้ว

    Thanks so much. Durga Sir.

  • @pratikshachauhan4152
    @pratikshachauhan4152 6 ปีที่แล้ว +5

    Sir as we can not access local inner class outside that method so how we can access method m2 of local inner class after completions of method m1 by local inner class object.

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  6 ปีที่แล้ว

      Hello Pratiksha.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627,7207212427/28

    • @benzo_uncle
      @benzo_uncle 5 ปีที่แล้ว

      hey, did you get your answer??

    • @dinkarjoshi3309
      @dinkarjoshi3309 5 ปีที่แล้ว

      You can, he is just wrong... I have tried it myself. In Java 11.

    • @dinkarjoshi3309
      @dinkarjoshi3309 5 ปีที่แล้ว +1

      Please note 1:02:00 all that is wrong. You can access the variable of the method (x in m1 in this case) from inside m2. If you see clearly he just gave almost the same example 5 min ago in the video.
      Experts please comment.
      I would say don't just blindly follow, code yourself and understand. Teachers are humans and can make mistakes. Also I would recommend to watch at 1.75x speed.

    • @rvs1790
      @rvs1790 4 ปีที่แล้ว +1

      @@dinkarjoshi3309 Hi Dinkar, He might be using old versions of java at that time. It was happening below java 7

  • @anishkumar221
    @anishkumar221 4 ปีที่แล้ว +1

    Durga sir happy Durga pooja🙏🙏🙏

  • @Lasaacademy
    @Lasaacademy 3 ปีที่แล้ว +2

    I am watching your videos
    Impressed a lot..
    I want to learn advanced java also
    Please help me so,
    How to contact

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  3 ปีที่แล้ว

      Hello Friend.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @shahzaiblashari7250
    @shahzaiblashari7250 6 ปีที่แล้ว +1

    just superb

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  6 ปีที่แล้ว

      Hello Gamer,
      Thanks for your valuable feedback.It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/U1KKyi
      You an see more Java videos following link:
      Java tutorial by durga sir
      goo.gl/XWb4RL
      Java 9 by durga sir
      goo.gl/hXGyBW
      Java 1.8 Version New Features by Durga sir
      goo.gl/iHXXYU
      Adv Java JDBC Tutorial by Durga sir
      goo.gl/8q16Eo
      OCJA 1.8 Java SE 8 Programmer - I (1Z0 - 808 ) By Durga sir
      goo.gl/gC6R7f
      Core Java by NagoorBabu sir
      goo.gl/s6Nvj1
      Advenced Java by Nagoorbabu sir
      goo.gl/ZZonzJ
      CoreJava by Ratan
      goo.gl/3VM19v
      Advanced Java jdbc by Ratan
      goo.gl/Rn2UXr
      Advjava tutorials - JSP by Ratan
      goo.gl/Z6ytxm
      Adv java servlets tutorial by ratan
      goo.gl/zTwi9y
      Servlet and JSP Tutorial by anji reddy
      goo.gl/jZMRUv
      Advanced Java Jdbc by Anjireddy
      goo.gl/16CGzX
      Hibernate byAnjireddy
      goo.gl/qQojvZ
      Struts by Anjireddy
      goo.gl/nE1Eof
      Spring by Mr.AnjiReddy
      goo.gl/NfN14R
      ADV JAVA by Naveen
      goo.gl/bhSsXF
      Spring by Mr.Naveen
      goo.gl/huVwFN
      Hibernate by Mr. Naveen
      goo.gl/TY3Wpd
      Struts by Mr.Naveen
      goo.gl/Vkmiw7

  • @arvindreddy6656
    @arvindreddy6656 6 ปีที่แล้ว +2

    Sir can u plz let me know from does the execution starts in INNER CLASSES as
    for Outer methods it starts from main.

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  6 ปีที่แล้ว

      Hello Aravind.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627,7207212427/28

    • @arvindreddy6656
      @arvindreddy6656 6 ปีที่แล้ว

      Thank you so much Durga sir for your response.
      Der s a small correction in my comment,its NOT OUTER METHOD BUT ITS an OUTER Class.

  • @ankitam6778
    @ankitam6778 5 ปีที่แล้ว +1

    Regarding to method local inner class- We are able to call static variable of outter class inside the inner class directly and not by class name.Static var. need to be access by class name inside instance area with class name, then how it is possible?

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  5 ปีที่แล้ว

      Hello Ankita.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @animeshjain677
    @animeshjain677 6 ปีที่แล้ว

    Sir plz show graphical representation of inner class

  • @chetanbg8885
    @chetanbg8885 8 ปีที่แล้ว

    Sir,
    In inner class m2 method after printing the values of x and y.. we r creating object of inner class??? (code at 50th minute)

  • @sateeshbabu5792
    @sateeshbabu5792 7 ปีที่แล้ว

    Super sir, thank you

  • @its_asm
    @its_asm 8 ปีที่แล้ว +1

    Hello Sir,
    I just tried 20 - 30 times my code not giving any error for your assertion @1:7:10(can't access local var(x) of method inside method local inner class)...please explain why.

  • @shubhamlutade5825
    @shubhamlutade5825 4 ปีที่แล้ว +1

    Time: 1:03:00
    We are able to access the instance variable declared inside the method
    public class methodLocalInnerclass {
    private int data = 30;// instance variable
    void display() {
    int u = 10;
    class Local {
    void msg() {
    System.out.println(data);
    System.out.println(u);
    }
    }
    Local l = new Local();
    l.msg();
    }
    public static void main(String args[]) {
    methodLocalInnerclass obj = new methodLocalInnerclass();
    obj.display();
    }
    }
    Output
    30
    10
    Please advice

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  4 ปีที่แล้ว

      Hello Shubham.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @cyberlanguage
    @cyberlanguage 10 หลายเดือนก่อน +1

    anna is a big fan of movies

  • @gautammaddyson
    @gautammaddyson 7 ปีที่แล้ว

    I am getting the output as:
    10
    20
    30
    40
    I don't see any errors as you mentioned in the video can you please elaborate about this example on final and static variable
    invoking directly.
    class Random
    {
    int i=10;
    static int j=20;
    public void m1(){
    int k=30;
    final int m=40;
    class Inner
    {
    public void m2(){
    System.out.println(i);
    System.out.println(j);
    System.out.println(k);
    System.out.println(m);
    }}
    Inner x= new Inner();
    x.m2();
    }
    public static void main(String[] args){
    Random y= new Random();
    y.m1();
    }
    }

  • @gaganyadav3247
    @gaganyadav3247 4 ปีที่แล้ว +1

    at 1:22:00 we can access instance method using class reference or object reference from static area, right ? so why can't we access i variable from inner class using object reference ?

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  4 ปีที่แล้ว

      Hello Gagan.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @VarunVishwakarma1
    @VarunVishwakarma1 6 ปีที่แล้ว

    Content is amazing but little slow

  • @SaurabhGupta-qy7nc
    @SaurabhGupta-qy7nc 8 ปีที่แล้ว +1

    Thank you sir

  • @tejasgowda4472
    @tejasgowda4472 8 ปีที่แล้ว +3

    Sir I declare local variable (i.e inside method) and tried to access from method local class, I am not getting any compile time error.
    Also I am using JAVA 8 , is there any updation done in JAVA 8 if yes then WHAT? & HOW IT WORKS ?.
    KINDLY REPLY ASAP

    • @alferatur
      @alferatur 8 ปีที่แล้ว +7

      " starting in Java SE 8, a local class can access local variables and parameters of the enclosing block that are final or effectively final. A variable or parameter whose value is never changed after it is initialized is effectively final."
      So, if you try to change the value "x" and call it you will have the same error. This is called effectively final variable.
      docs.oracle.com/javase/tutorial/java/javaOO/localclasses.html#accessing-members-of-an-enclosing-class

    • @tejasgowda4472
      @tejasgowda4472 8 ปีที่แล้ว +3

      thxz
      also I got a new job in Spring MVC + Liferay, is liferay is good

  • @vaibhavmhaskar6421
    @vaibhavmhaskar6421 3 ปีที่แล้ว +1

    @Duraga Sir, following code is not giving me any compile time error at line --> System.out.println(k);
    public class Test {
    int i =10;
    static int j = 20;
    public void m1() {
    int k= 30 ;
    final int m = 40;
    class Inner {
    public void m2() {
    System.out.println(i);
    System.out.println(j);
    System.out.println(k);
    System.out.println(m);
    }
    }
    Inner i = new Inner();
    i.m2();
    }
    public static void main(String[] args) {
    Test t = new Test();
    t.m1();
    }
    }
    output - 10
    20
    30
    40
    Could you please explain why it is so ?

    • @JaskaranSingh-hw5jf
      @JaskaranSingh-hw5jf ปีที่แล้ว

      After Java 8 local variable doesn't not need to declare Final explicitly , but It should be effectively final.
      Effectively Final means value of local variable should not change inside that method

  • @anjurawat9274
    @anjurawat9274 6 ปีที่แล้ว +1

    I understand the only purpose of using MLIC is supporting the nested method requirement still not getting first one purpose which is described in this video .......can anyone explain that to me ?...thanks in advance

    • @anjurawat9274
      @anjurawat9274 6 ปีที่แล้ว

      Subarna Sekhar Muni I am asking about what does mean of method specific repeating required functionality .....

    • @anjurawat9274
      @anjurawat9274 6 ปีที่แล้ว

      Subarna Sekhar Muni Now I got it...thanks for ur reply

  • @animeshjain677
    @animeshjain677 6 ปีที่แล้ว

    Where the inner class object is created
    inside the outer class or not

  • @mayurgite4050
    @mayurgite4050 8 ปีที่แล้ว

    Sir,
    I am facing problem when trying to write following code in Eclipse:
    Inner.this.x;// CE here
    C.E. : No enclosing instance of the type Outer.Inner is accessible in scope.
    I also called m1() method from main() of Outer. But still facing same compile time issue. Sir please help me out.
    Thanks a lot for this great efforts.

    • @mayankgupta6012
      @mayankgupta6012 8 ปีที่แล้ว +1

      can you please provide complete code? So, as to better understand the problem you are facing

  • @soumyaknowledgehub4878
    @soumyaknowledgehub4878 2 ปีที่แล้ว +1

    hashmap internal structure means?

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  2 ปีที่แล้ว

      Hello Soumya.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @राजनगोंगल
    @राजनगोंगल ปีที่แล้ว +1

    👍👍👍👍👍👍🙏🙏🙏🙏🙏🙏👌👌👌👌👌👌

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  ปีที่แล้ว

      Hello Friend.
      Thanks for your valuable feedback. It will boost us to do new things. Please subscribe to get updates about new videos.
      You can view all other Core Java with SCJP/OCJP Videos by Durga sir in the following link:
      goo.gl/kqvaf2

  • @shaheenshaikh6701
    @shaheenshaikh6701 6 ปีที่แล้ว

    sir can normal / regular inner class have static access specifier ?? plzzz telll as soo. as possible .

    • @jvsnyc
      @jvsnyc 4 ปีที่แล้ว

      If the class has static access specifier, it is not a normal, member inner class, it is a "nested static" class only.

  • @sanjuchakole2605
    @sanjuchakole2605 2 ปีที่แล้ว +1

    Hello sir,
    I am trying to run this code ( 1: 07: 01 ) but no CE error came,why, any reason for that???

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  2 ปีที่แล้ว

      Hello Sanju.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @shalinimarimuthu937
    @shalinimarimuthu937 7 ปีที่แล้ว

    Hi Sir,
    public class Outer {
    public void m1(){
    class inner{
    int x=10;
    public void m2(){
    System.out.println(x);
    }
    }
    inner a=new inner();
    a.m2();
    }
    public static void main(String[] args) {
    Outer b=new Outer();
    b.m1();
    }
    output :10(No error shown)
    Reason:

    • @bhagwanmal654
      @bhagwanmal654 ปีที่แล้ว

      bro you can access instance variable in non static method but m2 method you declare as static then error will occur

  • @064ganesh8
    @064ganesh8 2 ปีที่แล้ว +2

    public class Test {
    int x = 40;
    public void m() {
    int x = 67;
    class inner {
    int x = 23;
    public void sum() {
    System.out.println(x);
    System.out.println(this .x);
    System.out.println(Test.this.x);
    }
    }
    inner i = new inner();
    i.sum();
    }
    public static void main(String[] args) {
    Test t = new Test();
    t.m();
    }
    }
    Plz tell me how can I access method variable x

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  2 ปีที่แล้ว

      Hello Ganesh.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @SpritualMantra680
    @SpritualMantra680 7 ปีที่แล้ว

    class car{
    public void dis(){
    int x=6; //that is not final but execute without error
    class part{
    public void m1(){
    System.out.println(x);
    }
    }
    part t=new part();
    t.m1();
    }
    public static void main(String ar[]){
    new car().dis();
    }
    }
    that program working in jdk(1.8) without error .

    • @gautammaddyson
      @gautammaddyson 7 ปีที่แล้ว

      yeah i tried this absolutely working fine without final

  • @soumyajitbanerjee1440
    @soumyajitbanerjee1440 6 ปีที่แล้ว

    Sir , can inner class be static in method local inner classes?? Explain with reason.

    • @shaheenshaikh6701
      @shaheenshaikh6701 6 ปีที่แล้ว

      Banerjee Soumyajit same question ???

    • @soumyajitbanerjee1440
      @soumyajitbanerjee1440 6 ปีที่แล้ว

      Yes

    • @jvsnyc
      @jvsnyc 4 ปีที่แล้ว

      local methods can't have any static anything. Not static nested class, not a static method (methods don't have methods) and not a static variable....

  • @shraddhajayaraman
    @shraddhajayaraman 6 ปีที่แล้ว

    At 1:04 there is compiler error which I am not getting, When trying to access local variable of the method in which the inner class is declared, I am not getting any error. My program compiles and runs fine.

    • @Jasleen-jk7qo
      @Jasleen-jk7qo 6 ปีที่แล้ว +1

      Till JDK 7,Local inner class can access only final local variable of the enclosing block. However From JDK 8, it is possible to access the non-final local variable of enclosing block in local inner class.

  • @akashkumarkhatri9794
    @akashkumarkhatri9794 7 ปีที่แล้ว

    class Test {
    public void m1() {
    int x = 10;
    class Inner {
    public void m2() {
    System.out.println(x);
    }
    }
    new Inner().m2();
    }
    public static void main(String arg[]) {
    new Test().m1();
    }
    }
    Sir It execute without final No error show in jdk 1.8

  • @nikhilraghav9910
    @nikhilraghav9910 5 ปีที่แล้ว +1

    there is no compile-time or run-time error in below code public class LocalMethodInner {

    int value =20;
    static int value1 =30;

    public void testMethod(){
    int value3 = 40;
    final int value4 = 50;
    class Inner{
    int value5 = 60;
    final int value6 =70;
    public void method(){
    System.out.println(value3);
    }

    }
    Inner inner = new Inner();
    inner.method();
    }
    public static void main(String[] args) {
    LocalMethodInner localMethodInner = new LocalMethodInner();
    localMethodInner.testMethod();
    }
    Please suggest why we are able to access value3

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  5 ปีที่แล้ว

      Hello Nikhil.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

    • @nikhilraghav9910
      @nikhilraghav9910 5 ปีที่แล้ว

      @@DurgaSoftwareSolutions Thanks Durga Sir for reply.....I got answer I am using jdk 1.8 that why I am not getting any error......you are the best..

  • @vishalkm6296
    @vishalkm6296 7 ปีที่แล้ว

    I am able to access the x value inside m2 without any compilation issue. Even x is not final variable here(as per your video , it should not accessible ). Is this functionality modified in latest version of java?
    public class InnerFunction {
    public void m1(){
    int x=10;
    class A{
    void m2(){
    System.out.println(x);
    }
    }
    A a = new A();
    a.m2();
    }
    public static void main(String...str){
    InnerFunction i = new InnerFunction();
    i.m1();
    }
    }

    • @jonassx100
      @jonassx100 7 ปีที่แล้ว

      same here

    • @jonassx100
      @jonassx100 7 ปีที่แล้ว

      starting in Java SE 8, a local class can access local variables and parameters of the enclosing block that are final or effectively final. A variable or parameter whose value is never changed after it is initialized is effectively final."
      So, if you try to change the value "x" and call it you will have the same error. This is called effectively final variable.
      docs.oracle.com/javase/tutorial/java/javaOO/localclasses.html#accessing-members-of-an-enclosing-class
      REPLY
      2

    • @suryat1103
      @suryat1103 7 ปีที่แล้ว

      same here using java1.8

    • @rarnald1089
      @rarnald1089 2 ปีที่แล้ว

      @@jonassx100 bro...this effectively final concept is applicable for this method local inner class or... everywhere...

  • @sreejaitha6613
    @sreejaitha6613 ปีที่แล้ว +1

    Are these videos (203 videos in core java) outdated or useful

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  ปีที่แล้ว

      Hello Friend.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @madhinimohammad9657
    @madhinimohammad9657 6 ปีที่แล้ว

    at 1:05:10 u gave an example i executed in jdk10 it is executed it is not give compile time error why sir

    • @madhinimohammad9657
      @madhinimohammad9657 6 ปีที่แล้ว

      this is my mail madhinimd@gmail.com i will send u.java file and output also

    • @Jasleen-jk7qo
      @Jasleen-jk7qo 6 ปีที่แล้ว

      Till JDK 7,Local inner class can access only final local variable of the enclosing block. However From JDK 8, it is possible to access the non-final local variable of enclosing block in local inner class.

  • @sandeepkiran8039
    @sandeepkiran8039 7 ปีที่แล้ว

    if both outer and inner class are declared as public then what will b the file name ?

    • @obelix7349
      @obelix7349 7 ปีที่แล้ว +1

      you cannot declare two classes as public.

    • @sandeepe5989
      @sandeepe5989 6 ปีที่แล้ว +2

      Compiler will give you Left and Right , if you do so.

  • @krishnashauzshenikala9240
    @krishnashauzshenikala9240 5 ปีที่แล้ว

    It is possible

  • @saaryamohapatra2406
    @saaryamohapatra2406 5 ปีที่แล้ว +1

    Hello, can any one explain what is happening in this program ??
    Class A {
    abstract class B{
    abstract void m1();
    }
    }
    Class C extends A.B{
    C( A a){
    a.super( ); // - - -> (1)
    }
    void m1( ){
    System.out.println(“Hello”);
    }
    public static void main(String[ ] args){
    A a = new A( );
    C c = new C( a);
    c.m1( );
    }
    }
    I understand we can’t directly access inner class without existing outer class object. But what actually is happening at line (1) ??
    Why are we passing outer class reference to sub class constructor ??

    • @DurgaSoftwareSolutions
      @DurgaSoftwareSolutions  5 ปีที่แล้ว

      Hello Saarya.
      Plz contact our online team durgasoftonlinetraining@gmail.com or call us on this number +918885252627, 7207212427/28

  • @yankiboy7519
    @yankiboy7519 5 ปีที่แล้ว +1

    public class Test {
    public static Object m1() {
    final int x = 10;
    class Inner {
    public void m1() {
    System.out.println(x * x);
    }
    public String toString() {
    return "value of x is : " + x;
    }
    }
    Inner i = new Inner();
    i.m1();
    return i;
    }
    public static void m2(Object a) {

    System.out.println(a.getClass());
    System.out.println(a);

    }
    public static void main(String... a) {
    Object obj = m1();
    m2(obj);
    }
    }