Karthikeya Boyini has Published 2383 Articles

DoubleBuffer allocate() method in Java

karthikeya Boyini

karthikeya Boyini

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

58 Views

A new DoubleBuffer can be allocated using the method allocate() in the class java.nio.DoubleBuffer. This method requires a single parameter i.e. the capacity of the buffer. It returns the new DoubleBuffer that is allocated. If the capacity provided is negative, then the IllegalArgumentException is thrown.A program that demonstrates this is ... Read More

LocalDateTime query() Method in Java

karthikeya Boyini

karthikeya Boyini

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

83 Views

The LocalDateTime object can be queried as required using the query method in the LocalDateTime class in Java. This method requires a single parameter i.e. the query to be invoked and it returns the result of the query.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import ... Read More

Select all except the first character in a string in MySQL?

karthikeya Boyini

karthikeya Boyini

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

844 Views

To select all except the first character in a string, you can use SUBSTR() method. Let us first create a table −mysql> create table DemoTable (    FirstName varchar(20) ); Query OK, 0 rows affected (0.63 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('Larry'); Query ... Read More

DoubleBuffer asReadOnlyBuffer() method in Java

karthikeya Boyini

karthikeya Boyini

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

55 Views

A read-only double buffer can be created using the contents of a buffer with the method asReadOnlyBuffer() in the class java.nio.DoubleBuffer. The new buffer cannot have any modifications as it is a read-only buffer. However, the capacity, positions, limits etc. of the new buffer are the same as the previous ... Read More

LocalDateTime minus() method in Java

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

An immutable copy of a LocalDateTime where the required duration is subtracted from it can be obtained using the minus() method in the LocalDateTime class in Java. This method requires two parameters i.e. the duration to be subtracted and the TemporalUnit of the duration. Also, it returns the LocalDateTime object ... Read More

How to prevent MySQL double insert (duplicate entry)?

karthikeya Boyini

karthikeya Boyini

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

819 Views

To prevent duplicate entry, add constraint UNIQUE. Let us first create a table −mysql> create table DemoTable (    Id int,    Name varchar(100) ); Query OK, 0 rows affected (0.79 sec)Here is the query to prevent MySQL double insert using UNIQUE −mysql> alter table DemoTable add constraint id_NameUnKey UNIQUE(Id, ... Read More

LocalDateTime isSupported() method in Java

karthikeya Boyini

karthikeya Boyini

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

52 Views

It can be checked if a ChronoUnit is supported by the LocalDateTime class or not by using the isSupported() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the ChronoUnit to check. It returns true if the ChronoUnit is supported by the LocalDateTime class and ... Read More

Select MySQL rows where column contains same data in more than one record?

karthikeya Boyini

karthikeya Boyini

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

418 Views

Use MySQL JOIN to select MySQL rows where column contains same data in more than one record. Let us first create a table −mysql> create table DemoTable (    UserId int,    UserName varchar(20) ); Query OK, 0 rows affected (0.54 sec)Insert records in the table using insert command −mysql> ... Read More

DoubleBuffer slice() method in Java

karthikeya Boyini

karthikeya Boyini

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

74 Views

A new DoubleBuffer with the content as a shared subsequence of the original DoubleBuffer can be created using the method slice() in the class java.nio.DoubleBuffer. This method returns the new DoubleBuffer that is read-only if the original buffer is read-only and direct if the original buffer is direct.A program that ... Read More

LocalDateTime toLocalTime() method in Java

karthikeya Boyini

karthikeya Boyini

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

37 Views

The representation of the LocalTime can be obtained using the method toLocalTime() in the LocalDateTime class in Java. This method requires no parameters and it returns the LocalTime value of the LocalDateTime object.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.util.*; public class Demo { ... Read More

Advertisements