Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2016
    Posts
    47
    Rep Power
    0

    Default Can you create an instance of the class which contains the main ( )?

    Let's say I have a class called 'LibrarySystem' which contains the main ( ).

    Is it possible to create an instance of the 'LibrarySystem' class?

    When and why might a person need to create an instance of the "main" class that contains the main ( )?

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Can you create an instance of the class which contains the main ( )?

    Often the main class always has to invoke some class to get the application running. That class can either be the class that has
    the main() entry point or another class. It is up to the author of the app to decide how to handle things. I do not know of any
    particular best practice in this area.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Replies: 4
    Last Post: 12-03-2015, 04:09 PM
  2. Allowing users to create another instance of a class
    By wfsteadman in forum New To Java
    Replies: 5
    Last Post: 02-11-2013, 07:20 PM
  3. Replies: 2
    Last Post: 08-15-2011, 09:05 AM
  4. create new instance of variable class
    By Fedor in forum New To Java
    Replies: 5
    Last Post: 04-12-2009, 09:13 PM
  5. create Instance of class in Javascript
    By TDMaster in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-09-2009, 05:26 PM

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
  •