
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9150 Articles for Object Oriented Programming

489 Views
The ResultSet class doesn’t provide any direct method to get the number of records in a table.The beforeFirst() method navigates the pointer/curser of the ResultSet object to its default position before first.In the same way the last() method positions the cursor at the last row of the ResultSet object.Using these methods you can find the number of records in the current ResultSet object.ExampleAssume we have a table named customers table with contents as shown below:+----+---------+-----+---------+----------------+ | ID | NAME | AGE | SALARY | ADDRESS | +----+---------+-----+---------+----------------+ | 1 | Amit | 25 | 3000.00 ... Read More

129 Views
The contains() method of the AbstractCollection class checks whether an element is in the AbstractCollection or not. It returns a Boolean i.e. TRUE if the element is in the collection, else FALSE is returned.The syntax is as follows:public boolean contains(Object ele)Here, ele is the element to be checked for existence.To work with AbstractCollection class in Java, import the following package:import java.util.AbstractCollection;The following is an example to implement AbstractCollection contains() method in Java:Example Live Demoimport java.util.ArrayList; import java.util.AbstractCollection; public class Demo { public static void main(String[] args) { AbstractCollection absCollection = new ArrayList(); absCollection.add("Football"); ... Read More

972 Views
When you set a save point you define a logical rollback point within a transaction. If an error occurs past a save point, you can use the rollback method to undo either all the changes or only the changes made after the save point.Savepoint interface gives you the additional transactional control. Most modern DBMS, support save points within their environments such as Oracle's PL/SQL.Setting a save pointYou can set a save point in a database using the setSavepoint(String savepointName) method of the Connection interface, this method accepts a string value representing the name of the save point and returns a ... Read More

182 Views
The clear() method of the AbstractCollection class is used to remove all the elements from this collection. This makes the collection empty.The syntax is as follows:public void clear()To work with AbstractCollection class in Java, import the following package:import java.util.AbstractCollection;First, create AbstractCollection and add some elements using the add() method:AbstractCollection absCollection = new ArrayList(); absCollection.add("These"); absCollection.add("are"); absCollection.add("demo"); absCollection.add("elements");Now, clear the AbstractCollection:absCollection.clear();The following is an example to implement AbstractCollection clear() method in Java:Example Live Demoimport java.util.ArrayList; import java.util.AbstractCollection; public class Demo { public static void main(String[] args) { AbstractCollection absCollection = new ArrayList(); absCollection.add("These"); ... Read More

7K+ Views
You can insert null values into a table in SQL in two ways:Directly inserting the value NULL into the desired column as:Insert into SampleTable values (NULL);Using ‘ ’ as nullInsert into SampleTable values (NULL);While inserting data into a table using prepared statement object you can set null values to a column using the setNull() method of the PreparedStatement interface.pstmt.setNull(parameterIndex, sqlType);ExampleAssume we have a table named cricketers_data in the database with the following contents:+------------+------------+---------------+----------------+-------------+ | First_Name | Last_Name | Date_Of_Birth | Place_Of_Birth | Country | +------------+------------+---------------+----------------+-------------+ | Shikhar | Dhawan | 1981-12-05 | ... Read More

103 Views
The hashCode() method of AbstractList class returns the hash code value for this list.The syntax is as follows:public int hashCode()To work with the AbstractList class, import the following package:import java.util.AbstractList;The following is an example to implement hashCode() method of the AbstractlList class in Java:Example Live Demoimport java.util.ArrayList; import java.util.AbstractList; public class Demo { public static void main(String[] args) { AbstractList myList = new ArrayList(); myList.add(50); myList.add(100); myList.add(150); myList.add(200); myList.add(250); myList.add(300); myList.add(350); myList.add(400); ... Read More

103 Views
The set() method of the AbstractList class is used to replace the element at the specified position in this list with the specified element. It returns the element that gets replaced.The syntax is as follows:public E set(int index, E ele)Here, the parameter index is the index of the element to replace, whereas ele is the element to be stored at the specified position.To work with the AbstractList class, import the following package:import java.util.AbstractList;The following is an example to implement set() method of the AbstractlList class in Java:Example Live Demoimport java.util.LinkedList; import java.util.AbstractList; public class Demo { public static void main(String[] ... Read More

175 Views
The get() method of the AbstractList class is used to get the element at the specified position in the list. It returns the element at the position set as parameter.The syntax is as follows:public abstract E get(int index)Here, index is the index of the element to return.To work with the AbstractList class, import the following package:import java.util.AbstractList;The following is an example to implement get() method of the AbstractlList class in Java:Exampleimport java.util.LinkedList; import java.util.AbstractList; public class Demo { public static void main(String[] args) { AbstractList myList = new LinkedList(); myList.add(50); ... Read More

417 Views
To add elements to AbstractList class, the add() method is provided by the AbstractList class. The elemnt gets appended at the end of the list.The syntax is as follows:public boolean add(E ele)Here, the parameter ele is an element to be appended to this listTo work with the AbstractList class, import the following package:import java.util.AbstractList;The following is an example to add elements to AbstractlList class in Java:Example Live Demoimport java.util.LinkedList; import java.util.AbstractList; public class Demo { public static void main(String[] args) { AbstractList myList = new LinkedList(); myList.add(50); myList.add(100); ... Read More