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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:48:56+00:00 2026-05-18T10:48:56+00:00

This is getting made in a static void method in the main class. (class

  • 0

This is getting made in a static void method in the main class. (class being used for input).

private static void Input(ArrayList list)
{
   //other code...

   Object b = new Object(number, hour, minutes, seconds);
   list.Add(b)
}

Next I have another static void method to display the objects within.
The thing is i want to group them on the number, and then display all the hours, minutes and seconds for the same number underneath each other.
Then the following number(s) with all there corresponding hours, minutes and seconds.

But I am not sure how i can get the number for example the first array, and 2nd and so on.

How can I access this? The syntax below does not work and not sure how to retrieve this value(s).

int var = array[0].number; //does not work

Also how do i make a instance of this object again? I cannot use new again can i?

 private static void Output(ArrayList list)
{
   while (i < list.Count)
   {
      //keep track of current group (number)
      //announce group
      //...
   }
}

Regards.

  • 1 1 Answer
  • 1 View
  • 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-18T10:48:57+00:00Added an answer on May 18, 2026 at 10:48 am

    This is because you’re using a non-generic collection (ArrayList instead of List<T>). If you can, it would be much better to use a generic collection. However, if you’re forced to use ArrayList, you’ve got to cast:

    Foo foo = (Foo) list[0];
    int x = foo.number;
    ...
    

    (I hope you haven’t really named your own class Object… I would also recommend against using the name var as that is a contextual keyword as of C# 3.)

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

Sidebar

Related Questions

I made an imageview to include in other layouts and I am getting this
iI have some trouble getting sth like this to work in java: public class
Hope somebody can help me out of this confussion. I made this method: public
Given this code: public class MainActivity extends FragmentActivity implements ActionBar.TabListener { public static final
I'm getting insane with this one... I made a RESTful.NET webservice with C# and
I'm trying to output a list from an SQLite database and am getting this
This is getting me quite confused: I have a small application that uses a
Getting this out of the way; I don't frequently do much in php or
Getting this weird LINQ error. title = System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String Here is the code I have:
Am getting this error message and matched my brackets and couldn't find anything wrong.

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.