Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2016
    Posts
    26

    What is local class in java ?

    What is local class in java ?

  2. #2
    Senior Member
    Join Date
    May 2016
    Location
    Delhi
    Posts
    144
    3.11. Local Classes. A local class is declared locally within a block of Java code, rather than as a member of a class. Typically, a local class is defined within a method, but it can also be defined within a static initializer or instance initializer of a class.

  3. #3
    Registered User
    Join Date
    Apr 2014
    Location
    india
    Posts
    407
    A local inner class is not a member of the enclosing class and hence it can not have any access specifier.

  4. #4
    Member marisalewis24's Avatar
    Join Date
    Jul 2016
    Location
    United States
    Posts
    96
    Java Local inner class

    A class i.e. created inside a method is called local inner class in java. If you want to invoke the methods of local inner class, you must instantiate this class inside the method.

    Java local inner class example

    public class localInner1{
    private int data=30;//instance variable
    void display(){
    class Local{
    void msg(){System.out.println(data);}
    }
    Local l=new Local();
    l.msg();
    }
    public static void main(String args[]){
    localInner1 obj=new localInner1();
    obj.display();
    }
    }

  5. #5
    Junior Member
    Join Date
    Mar 2016
    Posts
    5
    A neighborhood class is announced locally inside a square of Java code, instead of as an individual from a class. Normally, a nearby class is characterized inside a strategy, however it can likewise be characterized inside a static initializer or occasion initializer of a class.

  6. #6
    Senior Member
    Join Date
    Jun 2016
    Posts
    196
    Local Classes. A local class is proclaimed locally inside a piece of Java code, as opposed to as an individual from a class. Normally, a local class is characterized inside a strategy, yet it can likewise be characterized inside a static initializer or occurrence initializer of a class.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.