Priya Pallavi has Published 70 Articles

What does the method toArray() do in java?

Priya Pallavi

Priya Pallavi

Updated on 25-Feb-2020 08:20:57

95 Views

The toArray() method of the java.util.ArrayList class returns an array containing all of the elements in this list in proper sequence (from first to the last element).This acts as a bridge between array-based and collection-based APIs.Exampleimport java.util.ArrayList; public class ArrayListDemo {    public static void main(String[] args) {       ArrayList ... Read More

What does the method add(int i, E element) do in java?

Priya Pallavi

Priya Pallavi

Updated on 20-Feb-2020 12:26:37

238 Views

The add(int index, E element) method of the java.util.ArrayList class inserts the specified element E at the specified position in this list. It shifts the element currently at that position (if any) and any subsequent elements to the right (will add one to their indices).Exampleimport java.util.ArrayList; public class ArrayListDemo { ... Read More

How to perform heapsort on an array in Java?

Priya Pallavi

Priya Pallavi

Updated on 19-Feb-2020 12:22:49

545 Views

Following is the algorithm for heapsort (maxheap).Step 1 − Create a new node at the end of the heap.Step 2 − Assign new value to the node.Step 3 − Compare the value of this child node with its parent.Step 4 − If the value of parent is less than a ... Read More

How to populate an array one value at a time by taking input from user in Java?

Priya Pallavi

Priya Pallavi

Updated on 19-Feb-2020 11:29:27

6K+ Views

To read data from user create a scanner class. Read the size of the array to be created from the user using nextInt() method. Create an array with the specified size. In the loop read the values from the user and store in the array created above.Exampleimport java.util.Arrays; import java.util.Scanner; ... Read More

Changing program title in SAP

Priya Pallavi

Priya Pallavi

Updated on 18-Feb-2020 07:26:15

581 Views

SET TITLEBAR function should be called from a module that is called from PBO of your screen.The title which you are providing should be active. This can be checked by loading your program in SE80 and check the program information in the tree to the right.

Getting error- Hard-coded logon parameters not allowed when using a Destination Configuration while connecting to SAP server dynamically

Priya Pallavi

Priya Pallavi

Updated on 14-Feb-2020 04:50:55

345 Views

You can try below sample code. I would suggest you to try using this:public class Program {    static void Main(string[] args) {       SapConnection con = new SapConnection();       RfcDestinationManager.RegisterDestinationConfiguration(con);       RfcDestination dest = RfcDestinationManager.GetDestination("NSP");       RfcRepository repo = dest.Repository; ... Read More

How can we write MySQL stored procedure to select all the data from a table?

Priya Pallavi

Priya Pallavi

Updated on 12-Feb-2020 07:53:37

870 Views

To demonstrate it we are creating a procedure named ‘selectdetails()’ which will fetch all the records from table ‘student_detail’.mysql> Delimiter // mysql> Create Procedure selectdetails()    -> BEGIN    -> Select * from student_detail;    -> END// Query OK, 0 rows affected (0.00 sec)Now, after invoking this procedure, we will ... Read More

How to parse a string to an int in C++?

Priya Pallavi

Priya Pallavi

Updated on 12-Feb-2020 06:28:22

1K+ Views

You can use a string stream to parse an int in c++ to an int. You need to do some error checking in this method.example#include #include using namespace std; int str_to_int(const string &str) {    stringstream ss(str);    int num;    ss >> num;    return num; } ... Read More

When can I use a forward declaration C/C++?

Priya Pallavi

Priya Pallavi

Updated on 11-Feb-2020 10:43:13

165 Views

Forward declaration lets the code following the declaration know that there is are classes with the name Person. This satisfies the compiler when it sees these names used. Later the linker will find the definition of the classes. exampleClass Person; void myFunc(Person p1) {    // ... } Class ... Read More

What does the volatile keyword mean in C++?

Priya Pallavi

Priya Pallavi

Updated on 10-Feb-2020 12:25:23

2K+ Views

volatile means two things −- The value of the variable may change without any code of yours changing it. Therefore whenever the compiler reads the value of the variable, it may not assume that it is the same as the last time it was read, or that it is the ... Read More

Advertisements