User Defined Variables vs Local Variables in MySQL

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

1K+ Views

The user defined variable is also known as session-specific variable. It is a type of loosely typed variable which can be initialized somewhere in session and contains the value of user defined variable until session ends.The user defined variable is prefixed with symbol @. For Example:@anyVariableName;There are two approaches by which you can initialize the user-defined variable. You can use SET command or using SELECT query. The first approach is as follows:SET @anyVariableName=anyValue;The second approach is as follows:SELECT @anyVariableName :=anyValue;If you do not use colon (:) in SELECT query then it evaluates it as expression. The result will either be ... Read More

Remove All Values from Java LinkedHashMap

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

350 Views

Use the clear() method to remove all the values from LinkedHashMap in Java.Create a LinkedHashMap and add some elements −LinkedHashMap l = new LinkedHashMap(); l.put("1", "Jack"); l.put("2", "Tom"); l.put("3", "Jimmy"); l.put("4", "Morgan"); l.put("5", "Tim"); l.put("6", "Brad");Now, let us remove all the values −l.clear();The following is an example to remove all values from LinkedHashMap −Example Live Demoimport java.util.*; public class Demo { public static void main(String[] args) { LinkedHashMap l = new LinkedHashMap(); l.put("1", "Jack"); l.put("2", "Tom"); ... Read More

Fill Elements in a Java Int Array in a Specified Range

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

758 Views

Elements can be filled in a Java int array in a specified range using the java.util.Arrays.fill() method. This method assigns the required int value in the specified range to the int array in Java.The parameters required for the Arrays.fill() method are the array name, the index of the first element to be filled(inclusive), the index of the last element to be filled(exclusive) and the value that is to be stored in the array elements.A program that demonstrates this is given as follows −Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String[] argv) throws Exception {     ... Read More

Replace All Elements of a Vector with Collections.fill in Java

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

625 Views

All the elements of a vector can be replaced by a specific element using java.util.Collections.fill() method. This method requires two parameters i.e. the Vector and the element that replaces all the elements in the Vector. No value is returned by the Collections.fill() method.A program that demonstrates this is given as follows:Example Live Demoimport java.util.Collections; import java.util.Vector; public class Demo { public static void main(String args[]) { Vector vec = new Vector(5); vec.add(7); vec.add(4); vec.add(1); ... Read More

Why Protected Access Modifier is Used in Java

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

275 Views

The data members and methods of a class can be accessed from the same package or sub-classes in a different package if they are specified with the protected access modifier. The keyword protected is used to specify this modifier.A program that demonstrates the protected access modifier in Java is given as follows:Example Live Democlass A {    protected int a = 9;    public void printA() {       System.out.println("Value of a = " + a);    } } public class Demo {    public static void main(String args[]) {       A obj = new A();     ... Read More

System Variables vs User-Defined Variables in MySQL

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

442 Views

System VariablesThe system variables are tightly typed variable. These are also known as global specific variable.The system variable can be initialized somewhere in global and contains the value of system variables until the server restarts. This value will destroy whenever you restart the MySQL server. The predefined system variable is prefixed with symbol @@.User-defined VariableThe user defined variable is also known as session-specific variable. It is a type of loosely typed variable which can be initialized somewhere in session and contains the value of user defined variable until session ends. The user defined variable is prefixed with symbol @.For Example:@anyVariableNameRead More

Change Current Count of Auto Increment Value in MySQL

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

486 Views

You can change the current count of an auto_increment in MySQL using ALTER command.The syntax is as follows −ALTER TABLE yourTableName AUTO_INCREMENT = IntegerValue;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table changeCurrentAutoIncrementValue    −> (    −> CurrentCount int auto_increment,    −> PRIMARY KEY(CurrentCount)    −> ); Query OK, 0 rows affected (0.60 sec)Insert records in the table using select statement. The auto_increment by default starts from 1 and increments by 1. The query to insert record is as follows −mysql> insert into changeCurrentAutoIncrementValue values(); Query ... Read More

Why Visible Learning is More Effective

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

206 Views

A good teacher teaches the children putting his best efforts, whereas a better teacher evaluates the effects of his teaching on his students and tries to improve his way of teaching. End of the day, improvement in the status of the student and his learning is more important.An improved process called as Visible Learning was made by John Hattie to help the teachers evaluate their teaching process. It says, “Know Thy Impact” by showing what the teachers have taught and what did the students learn, which enables to understand the gap so as to bridge it.Visible Learning is the concept ... Read More

Writing Style of Thomas Hardy vs Charles Dickens

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

2K+ Views

Victorian age is known as the richest age of English Literature. There was a rise in so many writings in terms of prose, fiction, and poetry. Out of the famous novelists, the contribution of Thomas Hardy and Charles Dickens cannot be overlooked.Thomas HardyBorn in Higher Bockhampton, Dorset, England on June 2, 1840, Thomas Hardy was a pessimistic critic and a novelist. His inclination towards the countryside and life of Vessex was reflected in his works.The man-nature relationship remains very indifferent to the man of his writings.In fact, Hardy's tragic vision is a part of his pessimism.The role of fate is ... Read More

Create a New ArrayList from Another Collection in Java

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

395 Views

An ArrayList can be created from another collection using the java.util.Arrays.asList() method. A program that demonstrates this is given as follows −Example Live Demoimport java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Demo {    public static void main(String args[]) throws Exception {       String str[] = { "John", "Macy", "Peter", "Susan", "Lucy" };       List aList = new ArrayList(Arrays.asList(str));       System.out.println("The ArrayList elements are: " + aList);    } }OutputThe ArrayList elements are: [John, Macy, Peter, Susan, Lucy]Now let us understand the above program.The string array str[] is defined. Then an ArrayList is created using ... Read More

Advertisements