Rishi Raj has Published 131 Articles

How to create immutable class in Java?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:23

441 Views

An immutable class object's properties cannot be modified after initialization. For example String is an immutable class in Java. We can create a immutable class by following the given rules below − Make class final − class should be final so that it cannot be extended. Make each field ... Read More

How to prevent Cloning to break a Singleton Class Pattern in Java?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:23

217 Views

A Singleton pattern states that a class can have a single instance and multiple instances are not permitted to be created. For this purpose, we make the constructor of the class a private and return a instance via a static method. But using cloning, we can still create multiple instance ... Read More

PriorityQueue Class in Java Programming

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:23

74 Views

The java.util.PriorityQueue class is an unbounded priority queue based on a priority heap.Following are the important points about PriorityQueue − The elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at queue construction time, depending on which constructor is used. A ... Read More

Private Constructors and Singleton Classes in Java Programming

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:23

1K+ Views

As we know the primary role of the constructor is to instantiate a class object now if we made the constructor as private then we restrict its calling to be only in defining a class and not in some other class. Now the singleton class in Java is defined as ... Read More

How does the value of system variable max_allowed_packet affect the result of a string-valued function?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:21

147 Views

String-valued functions return NULL if the length of the result would be greater than the value of the max_allowed_packet system variable. Actually, max_allowed_packet is a dynamic global variable which can accept the integer type values. These values can be set for a session only. It can accept 1024 as the ... Read More

How many keywords are there in C++?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:21

3K+ Views

There are a total of 95 reserved words in C++. The reserved words of C++ may be conveniently placed into several groups. In the first group, we put those that were also present in the C programming language and have been carried over into C++. There are 32 of these.There ... Read More

What does synchronized modifier do in Java?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:20

924 Views

The synchronized keyword used to indicate that a method can be accessed by only one thread at a time. The synchronized modifier can be applied with any of the four access level modifiers. Example Live Demo public class TestThread { public static Object Lock1 = ... Read More

What is the difference between a String object and a StringBuffer object in java?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:20

296 Views

String class is immutable once you create an object of string you can modify its data.The StringBuffer class is immutable, once you create a StringBuffer object you can change/modify the contents of it.This class provides various methods to manipulate its data such as append(), delete(), insert() etc. Read More

Error while using LOOP…..WHERE in SAP ABAP

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:20

204 Views

LOOP….WHERE condition was included recently in ABAP. Could you please verify your version?  This will work only on a version of 7.0 Ehp2 or higher.

Updating default value of new column in SAP system

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:20

246 Views

It is not good practice to update default values to a column as this will not be visible directly in the system and will not be picked by CTS. Also, there is no option in the SAP/ABAP environment of adding default values to the table column. If you choose to ... Read More

Advertisements