Chandu yadav has Published 1163 Articles

Remove all values from HashMap in Java

Chandu yadav

Chandu yadav

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

4K+ Views

To remove all values from HashMap, use the clear() method.First, let us create a HashMap.HashMap hm = new HashMap();Add some elements to the HashMaphm.put("Wallet", new Integer(700)); hm.put("Belt", new Integer(600)); hm.put("Backpack", new Integer(1200));Now, remove all the elementshm.clear();The following is an example to remove all values from HashMap.Example Live Demoimport java.util.*; public class ... Read More

Where does MySQL store database files?

Chandu yadav

Chandu yadav

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

2K+ Views

To know where MySQL store database files, you can use the variable @@datadir. The query is as follows −mysql> select @@datadir;The following is the output that displays the path −+---------------------------------------------+ | @@datadir ... Read More

Add 30 days to a value in a MySQL table?

Chandu yadav

Chandu yadav

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

545 Views

To add 30 days to a value in the table, you can use ADDDATE() function with UPDATE command. The syntax is as follows:UPDATE yourTableName SET yourDateColumnName=ADDDATE(yourDateColumnName, INTERVAL 30 DAY);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table Add30DayDemo ... Read More

Can MySQL INT type be non-zero NULL?

Chandu yadav

Chandu yadav

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

175 Views

You can set the INT column to value NULL.The column INT type a nullable column. The syntax is as follows:INSERT INTO yourTableName(yourIntColumnName) values(NULL);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table nullableIntDemo    -> (    -> Id ... Read More

What are the headers used in a Data Link Layer?

Chandu yadav

Chandu yadav

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

1K+ Views

Data Link Layer FrameA frame is a unit of communication in the data link layer. Data link layer takes the packets from the Network Layer and encapsulates them into frames. If the frame size becomes too large, then the packet may be divided into small sized frames. At receiver’ end, ... Read More

A Simplex Stop-and-Wait Protocol for an Error-Free Channel

Chandu yadav

Chandu yadav

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

9K+ Views

Stop – and – Wait protocol is data link layer protocol for transmission of frames over noiseless channels. It provides unidirectional data transmission with flow control facilities but without error control facilities.This protocol takes into account the fact that the receiver has a finite processing speed. If data frames arrive ... Read More

Are quotes around tables and columns in a MySQL query really necessary?

Chandu yadav

Chandu yadav

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

380 Views

If your table name or column name are any reserved words then you need to use quotes around table name and column name in a MySQL query. You need to use backticks around table name and column name. The syntax is as follows:SELECT *FROM `table` where `where`=condition;Here is the query ... Read More

How to verify enter number is phone number or not using regex in android?

Chandu yadav

Chandu yadav

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

2K+ Views

This example demonstrates how to verify enter number is phone number or not, using regex in android.Step 1 - Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 - Add the following code to res/layout/activity_main.xml. ... Read More

Arithmetic of Number Systems

Chandu yadav

Chandu yadav

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

5K+ Views

A number system is a set of symbols used to represent values derived from a common base or radix. In a number, the value of each digit can be determined using digit, position of the digit in the number, and the base of the number system. The base is defined as ... Read More

How to concatenate more than 2 fields with SQL?

Chandu yadav

Chandu yadav

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

13K+ Views

To concatenate more than 2 fields with SQL, you can use CONCAT() or CONCAT_WS() function. The syntax is as follows. Let us first see using CONCAT().SELECT CONCAT(yourColumnName1, '/', yourColumnName2, '/', yourColumnName3, '/', ......N) AS anyVariableName FROM yourTableName;The syntax is as follows:SELECT CONCAT_WS(‘/’, yourColumnName1, yourColumnName2, .....N) AS anyVariableName FROM yourTableName;To understand ... Read More

Advertisements