Sharon Christine has Published 413 Articles

How to calculate the size of folder using Java?

Sharon Christine

Sharon Christine

Updated on 20-Feb-2020 09:51:17

2K+ Views

You can get the size of a directory with the help of FileUtils.sizeofDirectory(File Name) method of FileUtils class.Exampleimport java.io.File; import org.apache.commons.io.FileUtils; public class Main {    public static void main(String[] args) {       long size = FileUtils.sizeOfDirectory(new File("C:/Windows"));       System.out.println("Size: " + size + " ... Read More

What is the difference between System.out.println() and System.out.print() in Java?

Sharon Christine

Sharon Christine

Updated on 20-Feb-2020 08:19:37

2K+ Views

The println() terminates the current line by writing the line separator string. The print() method just prints the given content.ExampleLive Demopublic class Sample {    public static void main(String args[]) {       System.out.println("Hello");       System.out.println("how are you");       System.out.print("Hello");       System.out.print("how are ... Read More

What is the difference between throw and throws keywords in Java?

Sharon Christine

Sharon Christine

Updated on 20-Feb-2020 06:39:20

406 Views

The throw keyword is used to raise an exception explicitly.Examplepublic class Test {    public static void main(String[] args) {       throw new NullPointerException();    } }Exception in thread "main" java.lang.NullPointerException at a6.dateAndTime.Test.main(Test.java:5)The throws keywords in Java used to postpone the handling of a checked exception.public class Test ... Read More

How to convert a Double array to a String array in java?

Sharon Christine

Sharon Christine

Updated on 19-Feb-2020 10:44:05

4K+ Views

You can convert a double array to a string using the toString() method. To convert a double array to a string array, convert each element of it to string and populate the String array with them.ExampleLive Demoimport java.util.Arrays; public class DoubleArrayToString {    public static void main(String args[]) { ... Read More

How to move an element of an array to a specific position (swap)?

Sharon Christine

Sharon Christine

Updated on 19-Feb-2020 10:17:30

3K+ Views

To move an element from one position to other (swap) you need to –Create a temp variable and assign the value of the original position to it.Now, assign the value in the new position to original position.Finally, assign the value in the temp to the new position.ExampleLive Demoimport java.util.Arrays; public ... Read More

How to declare an Array Variables in Java?

Sharon Christine

Sharon Christine

Updated on 19-Feb-2020 10:04:43

399 Views

You can declare an array just like a variable −int myArray[];You can create an array just like an object using the new keyword −myArray = new int[5];You can initialize the array by assigning values to all the elements one by one using the index −myArray [0] = 101; myArray [1] ... Read More

Difference between Internal tables, structures or work areas in SAP ABAP

Sharon Christine

Sharon Christine

Updated on 17-Feb-2020 06:48:21

7K+ Views

Internal tables − Internal tables are a means of storing data in the fixed format in working memory of ABAP. The data is stored line by line. So it is necessary for the data to be in a fixed format. Generally, they are used to store data in database tables to ... Read More

Adding an image to SAP Adobe form from MIME repository

Sharon Christine

Sharon Christine

Updated on 14-Feb-2020 08:23:22

2K+ Views

Note that Image must be uploaded from system to MIME beforehand.Run Transaction SE78 → Upload (F5).You have to declare 2 variables in the interface - global data with types string and xstring, You need to change the data declaration as below −data: gv_bmp_watermark type xstring. constants: gc_url_watermark type string value ... Read More

What are the rules to declare variables in C++?

Sharon Christine

Sharon Christine

Updated on 11-Feb-2020 08:06:43

12K+ Views

To declare a variable, you need to know what data type it is going to be of and what its name would be. The variable name has constraints on what you can name it. Following are the rules for naming variables − Variable names in C++ can range from 1 to ... Read More

What are enumerated data types in C++?

Sharon Christine

Sharon Christine

Updated on 11-Feb-2020 07:42:19

844 Views

An enumerated type declares an optional type name and a set of zero or more identifiers that can be used as values of the type. Each enumerator is a constant whose type is the enumeration. For example, if you are creating an application that has a fixed number of types ... Read More

Advertisements