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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:09:56+00:00 2026-06-14T09:09:56+00:00

How can i achieve this in java. i have an object which has properties

  • 0

How can i achieve this in java. i have an object which has properties.

public class Object {

    private final Credentials Credentials;
    private final int PageSize;
    private final int PageStart;
    private final int DefaultFilterId;

    public Object(Credentials Credentials, int PageSize, int PageStart, 
int DefaultFilterId) {
            this.Credentials = Credentials;
            this.PageSize = PageSize;
            this.PageStart = PageStart;
            this.DefaultFilterId = DefaultFilterId;
       }

    }

Now i am forming a this object like this

Object obj = new Object(args);

At some point i need the same Object, with new properties added but removing some.

I do something like this in javascript.

var myCars=new Array();
myCars[0]="Saab";
myCars[1]="Volvo";
myCars[2]="BMW";

delete myCars[1]; or myCars.splice(1,1);
  • 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-14T09:09:58+00:00Added an answer on June 14, 2026 at 9:09 am
    public class Object {
    
        private Credentials credentials;
        private int PageSize;
        private int PageStart;
        private int DefaultFilterId;
    
        public Object(Credentials credentials, int PageSize, int PageStart, int DefaultFilterId) {
            this.credentials = credentials;
            this.PageSize = PageSize;
            this.PageStart = PageStart;
            this.DefaultFilterId = DefaultFilterId;
        }
    
        // do that for the properties you want to be able to modify
        public void setCredentials(Credentials newCredentials) {
             this.credentials = newCredentials;
        }
    
    }
    

    And you use that:

    object.setCredentials(yourNewCredentials)
    

    Also, you shouldn’t name your object “Object”, it’s the base class for all the classes in Java.

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

Sidebar

Related Questions

The JDBC java.sql.Statement class has a cancel() method. This can be called in another
I have a Java class called CreateThread which creates one thread, everytime an object
I have a Class something like this in java for hadoop MapReduce public Class
How can I achieve this view with CSS: ------------------TITLE or TITLE------------------ I have <div
I have the following snippet of java code: final Class<?> junitCoreClass = AccessController.doPrivileged( new
I have a class hierarchy similar to this one: public static class BaseConfiguration {
I want to hide framelayout dynmically in android, How I can achieve this.
How can I achieve this behaviors onclick with jquery : default state: <a href=something.html>Anchor</a>
Can't seem to achieve this simple functionality! All I want is to clear a
I try that a User can be member of several associations. To achieve this

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.