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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:38:32+00:00 2026-06-15T23:38:32+00:00

i got a class call ClientIdBandwidth.java as shown at below public class ClientIdBandwidth {

  • 0

i got a class call ClientIdBandwidth.java as shown at below

public class ClientIdBandwidth
{
private int clientID;
private int bandwidth;

public ClientIdBandwidth(int clientID , int bandwidth)
{
    this.clientID = clientID;
    this.bandwidth = bandwidth;
}

public int getClientID()
{
    return clientID;
}

public int getBandwidth()
{
    return bandwidth;
}
}

i want to call the ClientIdBandwidth constructor and and put the data to the constructor? below is the code that i have do so far :

public class connectNode
{
private List[] connection;
private int totalClients;
totalClients = clientList.size(); //get the size from another class 
connection = new Vector[totalClients]; //  

for(int i = 0; i<totalClients; i++) 
    {
        connection[i] = new Vector(); 
    } 
for(int i = 0; i<totalClients; i++)
    {       
        int ID = (int)clientList.get(i);
        ClientIdBandwidth cib = new ClientIdBandwidth(ID,'0');
            }

after that, i have no idea how to continued on . can anyone teach me ? thanks in advance

UPDATE

sorry that i didnt make it clear.

i am now doing a p2p simulator. i have a text file :

0;2;100; // Node 0 connect to Node 2 with 100kbps

1;5;200; // Node 1 connect to Node 5 with 200kbps

i have class that will read the txt file. and it have put the total how many node(in example above is 4 which is Node 0,2,1,5) inside a list. now i want to set like node 0 is connect to node 2 with bandwidth to a vector.

  • 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-15T23:38:33+00:00Added an answer on June 15, 2026 at 11:38 pm

    Your code will work unexpected way in most of the cases. Your constructor is expecting 2 integer parameters, but you are passing one integer and one ‘char’ type. That might be the reason you are stuck/code not working/incorrect result etc (you haven’t said the exact issue).

    Or else, Your ClientBandwith object is getting created inside a for loop. It is created and destroyed all inside that for loop. At the end, when for loop is done, there will be no instances. So after the for loop, the ClientBandwith class will remain as it is, without EXISTING objects, so you can’t get anything using getters. In this case, you will not even notice what has happened. So you are complaining you can’t “put the data into the constructor” because the instance is getting destroyed?

    Apart from that,

    1. the ‘Vector’ is slow and outdated. Use ArrayList.

    2. If you know the exact size of the Vector, I think going for an Array is a good alternative

    3. You are creating a Vector inside a Vector. Is that is really useful here?

    4. Use Generics

    5. You are using 2 for loops. But as you can see, your work can be done by 1 for loop.

    6. Follow Java Naming standards. Your second class is starting with a simple letter

    7. if you want all the data in the Vector to be loaded to the constructor, your system will not work. Accept a List type as an argument

    8. when you ask a question, tell us what you really want to do

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

Sidebar

Related Questions

I've got a class that looks like: public class Competitor { public virtual int
I've got a class, like this, simplified: public class Bookmark { public string Nav
I've got this class, let's call it Refund (because that's what it's called). I
i've got the following simple webservice : [WebMethod()] public int Add(int a) { return
I've got class LoadViewController and on start i call this: - (void)viewDidLoad { [super
I've got class similar to this: class Krzyzowka { protected: char model[40][40]; int x,
Say I got a simple class with one public and one private method. If
I've got a class that looks something like this: public class Parent { public
I have this Parent Class call Shape (ShapeTwoD.cpp) He got 2 Child Class 1
I've got a class that have 3 methods public DoSth private DoItForReal private DoSthExtra

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.