Karthikeya Boyini has Published 2192 Articles

LocalDateTime getHour() method in Java

karthikeya Boyini

karthikeya Boyini

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

160 Views

The hour of the day for a particular LocalDateTime can be obtained using the getHour() method in the LocalDateTime class in Java. This method requires no parameters and it returns the hour of the day which can range from 0 to 23.A program that demonstrates this is given as follows ... Read More

Finding only strings beginning with a number using MySQL Regex?

karthikeya Boyini

karthikeya Boyini

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

413 Views

To find strings beginning with a number, use Regular Expressions. Let us first create a table −mysql> create table DemoTable (    Id varchar(200) ); Query OK, 0 rows affected (0.59 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('123User'); Query OK, 1 row affected (0.22 ... Read More

CharBuffer compareTo() method in Java

karthikeya Boyini

karthikeya Boyini

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

142 Views

A buffer can be compared with another buffer using the method compareTo() in the class java.nio.CharBuffer. This method returns a negative integer if the buffer is less than the given buffer, zero if the buffer is equal to the given buffer and a positive integer if the buffer is greater ... Read More

A Protocol Using Selective Repeat

karthikeya Boyini

karthikeya Boyini

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

12K+ Views

Selective repeat protocol, also called Selective Repeat ARQ (Automatic Repeat reQuest), is a data link layer protocol that uses sliding window method for reliable delivery of data frames. Here, only the erroneous or lost frames are retransmitted, while the good frames are received and buffered.It uses two windows of equal ... Read More

Java Program to read the next byte of data from the input stream

karthikeya Boyini

karthikeya Boyini

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

450 Views

The method java.io.InputStream.read() is used to read the next byte of data from the input stream. This method requires no parameters and it returns the next data byte in the form of int. If the stream end is reached, it returns -1.A program that demonstrates this is given as follows ... Read More

MySQL UPDATE using IF condition

karthikeya Boyini

karthikeya Boyini

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

11K+ Views

The syntax is as follows to perform UPDATE using IF condition in MySQL −update yourTableName set yourColumnName =if(yourColumnName =yourOldValue, yourNewValue, yourColumnName);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table updateIfConditionDemo    -> (    -> UserId int ... Read More

Format date in MySQL to return MonthName and Year?

karthikeya Boyini

karthikeya Boyini

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

144 Views

Use DATE_FORMAT() and set the specifiers to display only the MonthName and Year. Let us first create a table −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    AdmissionDate date ); Query OK, 0 rows affected (0.69 sec)Insert records in the table using insert command ... Read More

Custom ArrayList in Java

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

A custom ArrayList can have multiple types of data and its attributes in general are based on the user requirements.A program that demonstrates a custom ArrayList is given as follows −Example Live Demoimport java.util.ArrayList; public class CustomArrayList {    int n = 5;    class Employee {       int ... Read More

How to create Java Priority Queue to ignore duplicates?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

The simplest way to create a Java Priority Queue to ignore duplicates is to first create a Set implementation −HashSet set = new HashSet (); set.add(100); set.add(150); set.add(250); set.add(300); set.add(250); set.add(500); set.add(600); set.add(500); set.add(900);Now, create Priority Queue and include the set to remove duplicates in the above set ... Read More

Link Control Protocol (LCP)

karthikeya Boyini

karthikeya Boyini

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

6K+ Views

Link Control Protocol (LCP) is a part of Point – to – Point Protocol (PPP) that operates in the data link layer. It is responsible for establishing, configuring, testing, maintaining and terminating links for transmission. It also imparts negotiation for set up of options and use of features by the ... Read More

Advertisements