Nancy Den has Published 290 Articles

Instant atZone() method in Java

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

157 Views

An Instant can be combined with a timezone to create a ZonedDateTime object using the atZone() method in the Instant class in Java. This method requires a single parameter i.e. the ZoneID and it returns the ZonedDateTime object.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; public class ... Read More

How to write a JDBC application which connects to multiple databases simultaneously?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

6K+ Views

To connect with a database, you need toRegister the Driver: Select the required database, register the Driver class of the particular database using the registerDriver() method of the DriverManager class or, the forName() method of the class named Class.DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get connection: Create a connection object by passing the URL of ... Read More

Period plusDays() method in Java

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

173 Views

An immutable copy of the Period object where some days are added to it can be obtained using the plusDays() method in the Period class in Java. This method requires a single parameter i.e. the number of days to be added and it returns the Period object with the added ... Read More

Period equals() method in Java

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

163 Views

The equality of two Periods can be determined using the equals() method in the Period class in Java. This method requires a single parameter i.e. the Period object to be compared. Also it returns true if both the Period objects are equal and false otherwise.A program that demonstrates this is ... Read More

C++ Program to Implement Dijkstra’s Algorithm Using Set

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

630 Views

This is a C++ Program to Implement Dijkstra’s Algorithm using Set. Here we need to have two sets. We generate a shortest path tree with given source node as root. One set contains vertices included in shortest path tree and other set includes vertices not yet included in shortest path ... Read More

How to insert images in Database using JDBC?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

5K+ Views

The setBinaryStream() method of the PreparedStatement interface accepts an integer representing the index of the parameter and an InputStream object and sets the parameter to the given InputStream object. Whenever you need to send very large binary value you can use this method.And SQL databases provide a datatype named Blob (Binary ... Read More

C++ Program to Implement First Fit Decreasing for 1-D Objects and M Bins

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

176 Views

Here is a C++ Program to implement First Fit Decreasing for 1-D objects and M binsRequired functions and pseudocode:Begin    function binPack() returns number of bins required.    Initialize binC = 0    Initialize an array to store binVal.    Place items one by one.    function sort() to perform ... Read More

Write an JDBC example for inserting value for Blob datatype into a table?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

3K+ Views

Assume we already have a table named MyTable in the database with the following description.+-------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+---------+-------+ | Name | varchar(255) | YES | ... Read More

How can we retrieve a blob datatype from a table using the getBinaryStream() method in JDBC?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

724 Views

The ResultSet interface provides the method named getBlob() to retrieve blob datatype from a table in the database. In addition to this, it also provides a method named getBinaryStream()Like getBlob() this method also accepts an integer representing the index of the column (or, a String value representing the name of ... Read More

The toArray(T[]) method of AbstractSequentialList in Java

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

186 Views

The difference between toArray() and toArray(T[] arr) is that both the methods returns an array containing all of the elements in this collection, but the latter has some additional features i.e. the runtime type of the returned array is that of the specified array.The syntax is as follows:public T[] ... Read More

Advertisements