Samual Sam has Published 2310 Articles

What does the method fill(int[], int val) do in java?

Samual Sam

Samual Sam

Updated on 20-Feb-2020 12:42:04

135 Views

The fill(int[] a, int val) method of the java.util.Arrays class assigns the specified int value to each element of the specified array of integers.Exampleimport java.util.Arrays; public class ArrayDemo {    public static void main(String[] args) {       int arr[] = new int[] {1, 6, 3, 2, 9}; ... Read More

What does the method hashCode(int[] a) do in java?

Samual Sam

Samual Sam

Updated on 20-Feb-2020 12:31:32

149 Views

The hashCode(int[]) method of the java.util.Arrays class returns a hash code based on the contents of the specified array. For any two non-null int arrays a and b such that Arrays.equals(a, b), it is also the case that Arrays.hashCode(a) == Arrays.hashCode(b).Exampleimport java.util.Arrays; public class ArrayDemo {    public static void main(String[] ... Read More

How to open a plain text file in Java?

Samual Sam

Samual Sam

Updated on 20-Feb-2020 09:54:30

343 Views

You can access a plain text using the File class.ExampleLive Demoimport java.io.File; public class ReadFile {    public static void main(String[] args) {       File f = null;       String str = "data.txt";       try {          f = ... Read More

How to create a Directory recursively using Java?

Samual Sam

Samual Sam

Updated on 20-Feb-2020 09:49:22

348 Views

The java.io.File.mkdirs() creates the directory named by this abstract pathname, together with necessary and non-existent parent directories.ExampleLive Demoimport java.io.File; public class Main {    public static void main(String[] args) {       String directories = "D:\a\b\c\d ";       File file = new File(directories);       boolean ... Read More

Can private methods of a class be accessed from outside of a class in Java?

Samual Sam

Samual Sam

Updated on 18-Feb-2020 09:45:41

15K+ Views

You can access the private methods of a class using java reflection package.Step1 − Instantiate the Method class of the java.lang.reflect package by passing the method name of the method which is declared private.Step2 − Set the method accessible by passing value true to the setAccessible() method.Step3 − Finally, invoke ... Read More

Getting unauthorized exception in SAP ABAP

Samual Sam

Samual Sam

Updated on 18-Feb-2020 06:48:31

216 Views

To fix this issue, you need to add try/catch response to the code. When you don’t include an authorization header, it results in an error 401 from the server.try {     CatalogService.CatalogChangeClient service =      new CatalogService.CatalogChangeClient();     service.ClientCredentials.UserName.UserName = "username";     service.ClientCredentials.UserName.Password = "password";   ... Read More

How to check modules, functions, and tables in SAP ERP system.

Samual Sam

Samual Sam

Updated on 17-Feb-2020 07:51:21

1K+ Views

For searching within RFC modules, you can use the transaction BAPI (Business Application Programming Interface) for searching modules. The advantage of this approach is that they are completely documented and available on SAP website with sample usage examples. Also, SAP provides support for the same and in case you are ... Read More

What are C++ Character Constants?

Samual Sam

Samual Sam

Updated on 11-Feb-2020 08:21:37

2K+ Views

Character constants are one or more members of the “source character set, ” the character set in which a program is written, surrounded by single quotation marks ('). They are used to represent characters in the “execution character set, ” the character set on the machine where the program executes. ... Read More

What is different between constant and variable in C++?

Samual Sam

Samual Sam

Updated on 11-Feb-2020 08:10:33

2K+ Views

Variable and constant are two commonly used mathematical concepts. Simply put, a variable is a value that is changing or that have the ability to change. A constant is a value which remains unchanged.For example, if you have a program that has a list of 10 radii and you want ... Read More

What is type inference in C++?

Samual Sam

Samual Sam

Updated on 11-Feb-2020 08:02:36

782 Views

Type inference or deduction refers to the automatic detection of the data type of an expression in a programming language. It is a feature present in some strongly statically typed languages. In C++, the auto keyword(added in C++ 11) is used for automatic type deduction. For example, you want to ... Read More

Advertisements