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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:19:43+00:00 2026-05-30T18:19:43+00:00

Background: I’m creating a basic download centre on a concurrent server. I create file

  • 0

Background:

I’m creating a basic download centre on a concurrent server.

I create file objects in the Server class under a main method

File[] files = {
    new File("1. Program", "myProgram.jar"),
    new File("2. Image", "myPicture.jpg"),
    new File("3. Book", "myBook.txt")};

This references to the File class where I create constructors and getters.

class File {

    private String option;
    private String fileName;


    public File(String option, String fileName) {
        this.option = option;
        this.fileName= fileName;
    }

    public String getOption() {
        return option;
    }


    public String getFileName() {
        return fileName;
    }

    public void getFileOptions(File[] files) {
        for (File f : files) {
            System.out.printf("The option is %s\n", f.getOption());
        }
    } 
}

I am attempting to call the getFileOptions method from my ServerState class.

theOutput= File.getFileOptions(files);

The output is a string that is returned to a client.

My IDE says that (files) cannot be found. Any ideas where I’m going wrong? Cam I not return results to a class where the object wasn’t initially created?

  • 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-30T18:19:44+00:00Added an answer on May 30, 2026 at 6:19 pm

    OK so I have moved the File objects into the ServerState class and access the options using String theOutput = files[0].toString() + files[1].toString() + files[2].toString(); by calling a toString() method from the File class that also contain the object constructors, getters and setters.

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

Sidebar

Related Questions

Background I am trying to create a copy of a business object I have
Background I have been asked by a client to create a picture of the
Background: I'm running a Minecraft server for friends on a VPS, and I'm attempting
Background - I want to extract specific columns from a csv file. The csv
Background I have a basic HTML page with an iframe that points to a
Background My project is urgent and requires that I iterate a large XML file
Background: I am getting a Internal Server 500 24 50 error after deploying an
Background Use Ajax to fire an event to the web server when a list
Background I first wanted to upload a file via json and get a response
Background Currently, if I want to create a new object in C# or Java,

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.