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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T19:44:47+00:00 2026-05-16T19:44:47+00:00

Ok so here is what I need to do: I am reading in a

  • 0

Ok so here is what I need to do:

I am reading in a CSV file and need to generate a new instance of a class for each line.

I then need to store the reference variable for the class in a List.

I am ok with most of this but how do I generate a class using a variable

something like this

string newClassName;
int a = 1; //counts number of loops

while (bufferedScanner.hasNextLine());
{
    newClassName = SS + a;

    LightningStorms newClassName = new LightningStorms();

    a = a + 1;

}

I have left out a lot of extra code but its the setting up of the new class that I am interested in.

I am current learning and this is part of an assignment so want to figure most out for myself (there is a lot more to the question than this) but am stuck so any guidance would be very welcome.

Many 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-05-16T19:44:48+00:00Added an answer on May 16, 2026 at 7:44 pm

    You can get an instance of a Class object for a particular name using Class.forName() – this needs to be a fully qualified class, so java.lang.String not String.

    With the class object, you can construct a new instance using reflection, see Class.getConstructor()

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

Sidebar

Related Questions

I need some mind reading here, since I am trying to do what I
We've had an ongoing need here that I can't figure out how to address
Here's my issue: I need to close a process, already running, from a C#
Here is a snippet of CSS that I need explained: #section { width: 860px;
Here at work, we often need to find a string from the list of
Here's the situation: we have an Oracle database we need to connect to to
Here's another C#/.NET question based merely on curiousity more than an immediate need ...
I need to accept form data to a WCF-based service. Here's the interface: [OperationContract]
I need to pause for maybe 500 miliseconds before I submit a form. Here
Here is my scenario. For the example lets say that I need to return

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.