Karthikeya Boyini has Published 2193 Articles

How to list all files in a directory using Java?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Feb-2020 08:21:45

1K+ Views

You can get the list of files in a directory −Create a directory object using the File class.Get the list of directories in it using the getName() method.Exampleimport java.io.File; public class FindingDirectories {    public static void main(String args[]) {       String dir ="C:/Users/Tutorialspoint/Desktop/movies";       ... Read More

How to capture file not found exception in Java?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Feb-2020 06:58:29

379 Views

While using FileInputStream, FileOutputStream, and RandomAccessFile classes, we need to pass the path of the file to their constructors. In case of a file in the specified path does not exist a FileNotFoundException is raised.Examplepublic class Sample {    public static void main(String args[]) throws Exception {       ... Read More

How do I declare and initialize an array in Java?

karthikeya Boyini

karthikeya Boyini

Updated on 19-Feb-2020 10:06:11

724 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

How to access the private methods of a class from outside of the class in Java?

karthikeya Boyini

karthikeya Boyini

Updated on 18-Feb-2020 10:00:48

7K+ 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 the method ... Read More

What are up-casting and down-casting in Java?

karthikeya Boyini

karthikeya Boyini

Updated on 18-Feb-2020 09:57:00

2K+ Views

Typecasting is converting one data type to another.Up-casting − Converting a subclass type to a superclass type is known as up casting.Exampleclass Super {    void Sample() {       System.out.println("method of super class");    } } public class Sub extends Super {    void Sample() {   ... Read More

Getting a syntax error unknown fields in SAP ABAP

karthikeya Boyini

karthikeya Boyini

Updated on 18-Feb-2020 05:39:08

1K+ Views

You need to add spaces after or before braces as follows −SELECT  * FROM CNTRB WHERE AGE > 30 AND   CNTRB > 10000 AND NOT ( FUND1 = 'value' AND FUND2 = '0' )

Use decimal in where clause in SAP ABAP

karthikeya Boyini

karthikeya Boyini

Updated on 14-Feb-2020 10:05:41

203 Views

You are trying to use the user-specific setting in your queries, but ABAP does not support it. You need to use ‘.’ as the decimal separator instead of ‘,’.So the query would look something like −SELECT * FROM INTO WHERE amount = 10.15

Using GUI upload to attach a file to email in SAP

karthikeya Boyini

karthikeya Boyini

Updated on 14-Feb-2020 07:57:52

552 Views

You have to use parameters correctly in the function. You have to import the file length to an integer value.CALL METHOD cl_gui_frontend_services=>gui_upload_file ...     IMPORTING     filelength = fleng_i ...Next is to write to a character type variable and add parameter i_attachment_size to a class of add attachment.CALL ... Read More

What are C++ Integer Constants?

karthikeya Boyini

karthikeya Boyini

Updated on 11-Feb-2020 08:13:31

3K+ Views

Integer constants are constant data elements that have no fractional parts or exponents. They always begin with a digit. You can specify integer constants in decimal, octal, or hexadecimal form. They can specify signed or unsigned types and long or short types.In C++ you can use the following code to ... Read More

How do we initialize a variable in C++?

karthikeya Boyini

karthikeya Boyini

Updated on 11-Feb-2020 07:54:11

224 Views

You can initialize a variable using the assignment operator or use its constructor when initializing it. For example, int i = 0; MyClass instance(1, "Hello");It will be automatically initialized ifIt's a class/struct instance in which the default constructor initializes all primitive types; like MyClass instance; You use array initializer syntax, e.g. ... Read More

Advertisements