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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:32:25+00:00 2026-06-17T05:32:25+00:00

sorry, c++ programmer new to java strikes again i have this code public class

  • 0

sorry, c++ programmer new to java strikes again

i have this code

public class MainView extends View {

    static final int DRAW_LIST_SIZE=100;
    class EventDrawStuff {
        int         a;
        int         b;
        int         c;
    }
    static EventDrawStuff   m_drawList[] = new EventDrawStuff[DRAW_LIST_SIZE];

    class DrumEventDrawStuff {
        int     x;
        int     y;
    } 
    static DrumEventDrawStuff m_eventDrawStuff = new DrumEventDrawStuff();

the declaration of m_drawList seems to work ok, the declaration of m_eventDrawStuff doesn’t compile. what’s the difference, can t just be that m_drawList is an array?
i notice that if i say

static DrumEventDrawStuff[] m_eventDrawStuff = new DrumEventDrawStuff[1];

that is ok but i don’t really want it to be an array of one, since its only a single thing.
i realise the way to fix the original code is to initialize m_eventDrawStuff in the constructor but that seem cumbersome and unnecessary.

perhaps i’ve got the wrong idea altogether, please enlighten me, thanks

  • 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-06-17T05:32:26+00:00Added an answer on June 17, 2026 at 5:32 am

    You can do it in two way –

    1. Make your inner class static

    2. Create DrumEventDrawStuff object with the help of MainView object.

      static DrumEventDrawStuff m_eventDrawStuff = new MainView().new DrumEventDrawStuff();

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

Sidebar

Related Questions

I'm pretty new to Java (C# programmer) and I have here a problem that
I am new to Java. I'm a C++ programmer, reading some Java code. I
Sorry about the length of this question. I'm new to Java and I've come
Hey, Sorry if this is a dumb question. I'm an amateur programmer and new
I am sorry if this is an RTFM question, I am a C programmer
Sorry I am very new to open graph and have been having difficulty to
Sorry if this is a stupid question, but I have come across a problem
I'm still new to the Java world (former C++ programmer). I designed an Interface
I am currently doing a summer job as Java programmer. We have an application
i created a method in a new library this is my code namespace ClassLibrary1

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.