Elements can be added at the end of a Vector using the java.util.Vector.add() method. This method has a single parameter i.e. the element to be added. It returns true if the element is added to the Vector as required and false otherwise.A program that demonstrates this is given as follows:Example Live Demoimport java.util.Vector; public class Demo { public static void main(String args[]) { Vector vec = new Vector(5); for (int i = 1; i <= 10; i++) { vec.add(i); } System.out.println("The Vector elements ... Read More
Punctuation marks date back to at least the 5th century BC when there were hardly any insights to writing and there were only capital letters. While the basic rules of communication are not difficult to understand, still a confusion always bothers us during our interaction using British English or American English.Uses of Punctuation MarksThey help us in depicting our emotions in a better manner.Quotation marks to emphasize words and phrases.Quotation marks are used for purposes of dialogue, quotes, and titles.Comma, semicolon are also used to denote minor pauses while sleeping.Ellipses indicate the omission of words within something that is being quoted.Punctuation ... Read More
To remove NOT NULL restriction from column in MySQL, use ALTER command. The syntax is as follows:ALTER TABLE yourTableName MODIFY COLUMN yourColumnName dataType;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table NotNullDemo -> ( -> Id int NOT NULL AUTO_INCREMENT, -> Name varchar(20) NOT NULL, -> PRIMARY KEY(Id) -> ); Query OK, 0 rows affected (0.58 sec)In the above table, if you insert the NULL value to the column ‘Name’ then MySQL will give an error of NOT NULL restriction. The query to ... Read More
To create NavigableMap from TreeMap. The following is the declaration −NavigableMap n = new TreeMap();Now, add some elements to the NavigableMap created above −n.put("A", 888); n.put("B", 999); n.put("C", 444); n.put("D", 555); n.put("E", 666); n.put("F", 888); n.put("G", 999); n.put("H", 444); n.put("I", 555); n.put("J", 666);The following is an example to create NavigableMap from TreeMap and display it −Example Live Demoimport java.util.*; public class Demo { public static void main(String[] args) { NavigableMap n = new TreeMap(); n.put("A", 888); n.put("B", 999); ... Read More
Set column charset using character SET command. The syntax is as follows −ALTER TABLE yourTableName MODIFY youColumName type CHARACTER SET anyCharcaterSetName;You can use character set name utf8 or something elsE. To set column charset, let us first create a table. The query to create a table is as follows −mysql> create table setCharsetDemo −> ( −> FirstName varchar(60) −> ); Query OK, 0 rows affected (2.09 sec)Now you can check the current column character set with the help of show command. The query is as follows −mysql> show create table setCharsetDemo;The ... Read More
All these are prepositions and impart a sense of being something on the top of some other object. Therefore, we can say that all of them have a similar meaning-not largely but at least to some extent. However, similar meaning yet varied definitions still confuse many learners. So, here I explain the correct and simple definition along with the usage of these three confusing words.1. OnDefinition: Having covered something; part of the surfaceA simple definition of ‘On’ is-One thing is covering the other. Generally, it touches the other object or its surface. Also, it can a part of the surface in ... Read More
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, data link layer picks up signals from hardware and assembles them into frames.Fields of a Data Link Layer FrameA data link layer frame has the following parts:Frame Header: It contains the source and the destination addresses of the frame and the control bytes.Payload field: It contains the message to be ... Read More
You can add a value to each row in MySQL using UPDATE command.Let us see when your column is an integer. The syntax is as follows:UPDATE yourTableName SET yourIntegerColumnName = yourIntegerColumnName+anyValue; UPDATE yourTableName SET yourIntegerColumnName = anyValue WHERE yourIntegerColumnName IS NULL;You can add a value for a date column name. The syntax is as follows:UPDATE yourTableName SET yourDateColumnName = DATEADD(yourDateColumnName, INTERVAL anyIntegerMonth)To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table addEachRowValue -> ( -> Id int NOT NULL AUTO_INCREMENT, -> Amount int, -> ShippingDate ... Read More
To remove all the elements from LinkedHashSet in Java, use the clear() method.The following is an example to declare LinkedHashSet and add elements to it −LinkedHashSet hashSet = new LinkedHashSet(); hashSet.add(10); hashSet.add(20); hashSet.add(30); hashSet.add(40); hashSet.add(50); hashSet.add(60);Use the clear() method to remove all elements −hashSet.clear();The following is an example −Example Live Demoimport java.util.LinkedHashSet; public class Demo { public static void main(String[] args) { LinkedHashSet hashSet = new LinkedHashSet(); hashSet.add(10); hashSet.add(20); hashSet.add(30); ... Read More
The Simplex protocol is data link layer protocol for transmission of frames over computer network. It is hypothetical protocol designed for unidirectional data transmission over an ideal channel, i.e. a channel through which transmission can never go wrong.It is assumed that both the sender and the receiver are always ready for data processing and both of them have infinite buffer. The sender simply sends all its data available onto the channel as soon as they are available its buffer. The receiver is assumed to process all incoming data instantly. It is does not handle flow control or error control. Since ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP