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 7593587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:12:27+00:00 2026-05-30T21:12:27+00:00

I am new to Java so I am trying to get my head around

  • 0

I am new to Java so I am trying to get my head around some of the concepts of Java, so be gentle with me!.

I have my main MASTER CONTROLPANEL CLASS which contains the main of the program, and I Insantiate the building class which contains instances of the rooms class,
and the rooms class contains instances of the walls class,
and the walls contains instances of the windows class.

Basically constructing the building, each instantiation of the rooms class will have different amount of instances of walls, and walls different amount of windows, primitive height and widths etc..

What is the best way to go about the design of this?, as in creating the dynamic amount of walls and windows, is the only way with accessor methods? and just altering the measurements in the MAIN of the program? or having a method to add each wall individually to an arraylist for each room? and if so where is the best place to place these?

Thanks very much for any help.

  • 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-30T21:12:28+00:00Added an answer on May 30, 2026 at 9:12 pm

    Follow the rule of thumb.

    1. Wherever your problem definition has has-a, you got composition. If you are going to has-many, you may use a Collection — as you said, List of walls, and List of windows.

    2. You may also, abstract stuffs, have Window as abstract class and can use implementation for StandardWindow or ManSizeWindow — this is a is-a relationship. as in StandardWindow is a Window. You are likely to have this kind of stuff in your problem where you are required to decorate the rooms with same kind of stuff but different properties.

    Also, do not use rigid code, like have classes that have, say, three windows attributes and three getters/setters them. You are likely to regret later with this technique.

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

Sidebar

Related Questions

I'm still trying to get my head around using Java's generics. I have no
I'm new to Java and JMock and I'm currently trying to get my head
I have done a google around but can't get my head around what's wrong
I am relatively new to Java and while trying out some code came across
Extremely new to Java an just playing around with it. I'm trying to add
I'm new to Java portlets, and am trying to get a handle on how
I'm new to Ruby coming from Java. I'm trying to make a http get
I am new to Java and am trying to run a program using Eclipse.
Just a warning: I'm completely new to Java and am trying to teach myself
I'm new to java and I'm trying to swap out the text on a

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.