Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1093181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:47:30+00:00 2026-05-16T23:47:30+00:00

I am trying to understand how the following code ties into two other .java

  • 0

I am trying to understand how the following code ties into two other .java files that are in the package template. In the main method are three class being instantiated? Why put them in the main method if everything is in the package template? Will these all have Driver class as a superclass? And finally are any of the words in the three classes that are being instantiated java specific words with the exception of the work “new”. Thanks for any insight into this. I am trying to understand how a project fits together so that I can write a recursive algorithm to search files. Thank you
One more question I want to make sure that I understand is why is gui in the parameter for DirectoryLister….DirectoryLister(gui);??? Does it need to be there in the main class so that it can call methods from gui??

package template;

import javax.swing.*;

public class Driver
{
  public static void main(String[] args)
   {
       GUI gui = new GUI();
       DirectoryLister dl = new DirectoryLister(gui);
       gui.registerModel(dl);
   }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:47:30+00:00Added an answer on May 16, 2026 at 11:47 pm

    Lot of questions:

    • In the main method are three class being instantiated?

    No, only two are explicitly instantiated: GUI and DirectoryLister.

    • Why put them in the main method if everything is in the package template?

    main method is just the entry point for your program. You may or may not put everything inside main method. Just keep in mind that that’s where your program will start executing.

    • Will these all have Driver class as a superclass?

    If you are referring to GUI and DirectoryLister then the answer is NO. Not at all. They’re completely independent.

    • Are any of the words in the three classes that are being instantiated Java specific words with the exception of the work “new”?

    No. None of them.

    • I want to make sure that I understand is why is gui in the parameter for DirectoryLister….DirectoryLister(gui);??? Does it need to be there in the main class so that it can call methods from gui??

    DirectoryLister probably expects a GUI instance in one of its constructors. You are building your dl object with gui element by calling DirectoryLister(GUI g) constructor.

    —

    Also, keep in mind that your question is not related to JavaME as you tagged it. It’s just a plain Java question. You won’t be using JavaME here since you are importing javax.swing.* which is not available for JavaME edition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how Boost memory mapped files work. The following code
I found the following code example (from Telerik ) that I'm trying to understand.
I'm trying to understand what it is about the following code that is perfectly
Hey I am trying to understand the following code snippet. public static void main(String[]
I am trying to understand the following code: #include<stdio.h> #include<stdlib.h> #include<sys/io.h> #define baseport 0x378
i am trying to understand following fragment of javascript code <!DOCTYPE html> <html> <body>
I was just trying to understand delegates using the following code. public class delegatesEx
I have the following class written by someone else that I'm trying to understand
I have the following code, I am trying to understand why all the elements
So I am trying to understand OOP more and use it. The following code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.