Search:

Type: Posts; User: Pratyush

Search: Search took 0.10 seconds.

  1. Replies
    2
    Views
    3,186

    Re: Printing loop twice?

    Try while loop instead of do while loop. Go through the details of while and do while which will make you clear regarding the issue you are facing. When you use do while your code actually gets...
  2. Re: Null Pointer Exception. How to fix this problem?

    Go to line number 119 (as clearly mentioned in the stacktrace) of your servlet class named AddRewardsPages.java and check for the variable in that line which is used. That variable must be null. Try...
  3. Replies
    7
    Views
    1,363

    Re: How to clone a singleton class?

    Thanks for the answer. I tried cloning a singleton. It was exactly the same as you have told. Like the non singleton instance.
  4. Replies
    7
    Views
    1,363

    Re: How to clone a singleton class?

    I got your context of getting confused that if suppose I am making a class singleton whats the exact reason I would like to clone it. Its just for my understanding I need to know when I make a...
  5. [SOLVED] Re: how to call single instance of class? singlet.

    Singleton concept is basically implemented when we require to use a single instance of a class throughout the application. For this we follow some rules.

    1. We don't allow any class to create the...
  6. Replies
    7
    Views
    1,363

    Re: How to clone a singleton class?

    Not tried cloning an instance ever but I know that the class needs to implement the Cloneable interface and override the clone method of the object's class(Please correct if I am wrong anywhere). But...
  7. Re: Why do we make variables of a class private?

    Thanks for very clear and transparent answer. I seem to get it now more and more. Basically what it means is that we follow such standards so as to enhance flexibility and maintainability of the code...
  8. Why do we make variables of a class private?

    I know that variables are made private in simple pojos so as to implement the concept of encapsulation. But my question is why do we do that if we indirectly access the same object's variable through...
  9. Replies
    7
    Views
    1,363

    How to clone a singleton class?

    I know to make a singleton class but if suppose I require to clone it how can that be done.
    If anybody can reply with sample code it would be better.

    Thanx in advance!
Results 1 to 9 of 9