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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:28:51+00:00 2026-05-31T22:28:51+00:00

So these 2 files I am going to post are each in my DataBase

  • 0

So these 2 files I am going to post are each in my DataBase package. The DBBinding class just needs to create an object with a string for the key and one for the value. Then the DBrecord is going to keep a collection of DBBindings that all have the same key string but diffrent value strings. For some reason I can not think/find the correct way to make a add method in DBrecord so that it calls the DBBinding class/objects constructor.

This is the method that is supposed to add the binding:

private void addRecord(String key_, String value_)
{
    //DBBinding myDBBinding=new DBBinding(key_, value_);//constructor not defined error
    //DBBinding myDBBinding(key_,value_);
    //DataBase.DBBinding myDBBinding=new DataBase.DBBinding(key_, value_);//constructor not defined error

}

Here’s the DBBinding code followed by the DBrecord code.

package DataBase;

public class DBBinding {

    private String key;
    private String value;

    public void DBBinding(String key_, String value_)
    {
        String key =new String(key_);
        String value=new String(value_);
    }

    //public String toString()
    //{return key+": "+value;}

}

and

package DataBase;
//package DataBase.*;
import DataBase.*;//did not help ... ?

public class DBrecord {

    boolean select;
    String key;
    //need some type of collection to keep bindings. 

    public void DBrecord()
    {
        DBrecord myRecord=new DBrecord();
        select=false;
    }

    private void addRecord(String key_, String value_)
    {
        //DBBinding myDBBinding=new DBBinding(key_, value_);//constructor not defined error
        //DBBinding myDBBinding(key_,value_);
        //DataBase.DBBinding myDBBinding=new DataBase.DBBinding(key_, value_);//constructor not defined error

    }

    public String toString()
    {
        //out put key first then all values in collection/group/record. use correct formatting. 
    }



}
  • 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-31T22:28:53+00:00Added an answer on May 31, 2026 at 10:28 pm

    In class DBBinding you must have public DBBinding(String key_, String value_), the void makes the “constructor” actually to a method 🙂

    You have the same error in DBrecord.

    By the way, don’t do this:

    String key =new String(key_);
    

    Strings are immutable, nothing can happen if you “share” them. But your code forces Java to create a new object for an absolutely identical value. So use just

    String key = key_;
    

    However, in your case even this is wrong, as you create a new local variable key “shadowing” the class variable key. Look here for an explanation.

    So alltogether DBBinding should look like:

    package DataBase;
    
    public class DBBinding {
    
        private String key;
        private String value;
    
        public DBBinding(String key_, String value_)
        {
            key = key_;
            value =  value_;
        }
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a folder with these files: alongfilename1.txt <--- created first alongfilename3.txt <--- created
On install I copy some files in 'System32' folder. When uninstalling these files are
I want to provide dynamic download of files. These files can be generated on-the-fly
I have a python project with this directory structure and these files: /home/project_root |---__init__.py
I need to get the size of files. These files range in size from
I have 4 files sorted alphabetically, A, B, C, and D. These files contain
I have an index.html and global.css files. When I open these files at Coda,
I have a dozen configuration properties files for the ant script. These files are
Ive started working on a product that uses license files. These files need to
Say I have this url: http://site.example/dir/ In this folder I have these files: test.ascx.cs

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.