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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:24:06+00:00 2026-06-16T04:24:06+00:00

I have a very simple program for a homework assignment, I’m trying to group

  • 0

I have a very simple program for a homework assignment, I’m trying to group bills by years and months using a class called “Payment” (terrible name, I know) that I store within an ArrayList (I’m open to suggestions for a better container).

However I get a strange error message from Eclipse (will put at end).

public class Payment {
    private double[] Month;
    private int Year;
    private boolean Paid;

    ....
    // A lot of setters, getters, nothing important
}

Now I want to create an array list

import java.util.ArrayList;

public class Bill {
    ArrayList<Payment> Money = new ArrayList<Payment>();
    Money. // error -> Money didn't get highlighted, intellisense did not provide 
                      // a list of methods

Error reads as follows:

Multiple markers at this line:
    Syntax error, insert "enum Identifier" to complete EnumHeaderName
    Syntax error on token "Money", delete this token
    Syntax error on token "Money", delete this token
    Syntax error, insert "EnumBody" to complete EnumDeclaration

I have absolutely no idea why this happens. I went in my main file to test this out, it works there, just not here, within the “Bill” class, which is basically empty right now.

  • 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-16T04:24:07+00:00Added an answer on June 16, 2026 at 4:24 am

    Seems like you are trying to call some ArrayList method on Money reference.

    Note that, you cannot have statements like that directly inside the class. You need to have some method where you can put it.

    Here’s an example: –

    public int getListSize() {
        return Money.size();
    }
    

    If you put Money.size() outside all the methods, it will be a compiler error.
    : –

    public class Demo {
        Money.size();  // Compiler Error
    
        public void getSize() {
            Money.size();   // Ok. Well, I have just added it plain to show it works
                            // Ideally you would return it, or print it.
        }
    }
    

    However, you can have the call on the RHS, to assign the return value to an int: –

    public class Demo {
        int size = Money.size();  // Now this is fine
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple program that I am trying to improve performance. One
I have this very simple c++ program. It's been years that I did some
I have a very simple example program that I am trying to compile, but
I am trying to compile a very simple program using the -m32 flag. If
I am trying to get a very simple program to compile while using functions
I have created a very simple program that uses recursion. I'm using the g++
I have a very simple print program called print.c: #include <stdio.h> int main(void){ printf(Random
I have a very simple test program, running on Solaris 5.8: #include <stdio.h> #include
It's a very simple program. I have a function defined on the top and
I have a very simple question. I have a program that accepts an integer

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.