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

  • SEARCH
  • Home
  • 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 3347968
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:29:07+00:00 2026-05-18T01:29:07+00:00

Still coming from C++ I find it cumbersome to create many small helper classes

  • 0

Still coming from C++ I find it cumbersome to create many small helper classes and objects. Mostly because I have to have one file per class. I basically have a class like this:

public class mySimpleClass {
    public float[] numbers = new float[ 4 ];
}

And then I have this class:

public class myNotSoSimpleClass {
    private mySimpleClass;
    .
    .
    .
}

The second class which is not so simple is ok to have in its own file. However, the simple class is connected to the not so simple class and it would be very nice to not have to have those few lines of code in its own file.

So to sum it up, this is what one could do in C++:

public class myNotSoSimpleClass {
    private struct mySimpleClass {
        float numbers[ 4 ];
    } myStruct;
    .
    .
    .
}

Is it possible to embed/use one class inside another class, or the same file? I would just find it easier to work with large projects if I could set up these two classes into one file. Or is Java a strictly one class per file, and that’s it, language?

  • 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-18T01:29:08+00:00Added an answer on May 18, 2026 at 1:29 am

    It is possible to have one class inside of another class. In Java, it’s called an inner class

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

Sidebar

Related Questions

Coming from C/C++ a long time ago I still have a habit of ensuring
I have recently started learning C++ and coming from a Ruby environment I have
I'm coming from the C++ world and I can't find what is the Java
I have a simple question. Coming from a java background and having worked extensively
I'm coming from Ruby on Rails, and I need to create a C# web
Coming from Java, I am new to C# and LINQ. There are many queries
I'm new to Node and coming from a C# background one of the main
I still find myself hand coding Visual Studio projects more than using the variety
still new to XML parsing with the iphone so i have a few questions.
I am a Python newbie coming from a C++ background. While I know it's

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.