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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:11:15+00:00 2026-06-11T02:11:15+00:00

i am fairly new to java so was wondering if i could get some

  • 0

i am fairly new to java so was wondering if i could get some basic help.

I have a class called Timetable

public class Timetable
{   private String Month;
    private String Day;
    private int[] times;

public Timetable(String month, String Day, int[] times) 
    {
        this.month = month;
        this.day = day;
        //initalize various times..

This class relates to another class(LinkedList) of Timetables that adds the month,day and times. like this..

Add(new Timetable("May","Monday", **???**));

now i need to add the times that are in an array and vary such as {1,2,3,4} or {2,4,9} and there are only int[4] indexes.

Any Suggestions of how i initialize the times and pass the int[] times to the create the timetable??

  • 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-11T02:11:16+00:00Added an answer on June 11, 2026 at 2:11 am

    Additionally to the other answers you could also adapt your constructor signature to

    public Timetable(String month, String Day, int... times) { /*...*/ }
    

    The usage within your Timetable class would remain the same (the int... argument is mapped to an array of ints) but the advantage would be that the calls would be simplified to

    LinkedList<Timetable> link = new LinkedList<Timetable>();
    
    link.add(new Timetable("May", "Monday", 1, 2, 3, 4)); // array creation is now optional
    link.add(new Timetable("May", "Monday", new int[]{1, 2, 3, 4})); // works as well
    link.add(new Timetable("June", "Sunday", 5, 6, 7));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fairly new to Java and I was wondering how I could get all
Fairly new to Java, so I hope the wording makes sense. I have some
I am fairly new to Java. I have constructed a single JUnit test class
I'm fairly new to Java, and I need some help figuring out a good
I am fairly new to Java, and recently I was reading some material about
I have been working on Eclipse recently. I am fairly new to java programming,
I'm fairly new to Java. Currently trying to have the filename given in args[]
I am fairly new to C# coming from Java, and I'm wondering if there's
I'm fairly new to Java and have a doubt that needs to be cleared.
I'm fairly new to Java and I've been having some difficulties with Swing. I'm

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.