- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Updated on 30-Jul-2019 22:30:25
It can be checked if the days, months and years in the Period are negative or not using the isNegative() method in the Period class in Java. This method requires no parameters. Also, it returns true if any of the days, months and years in the Period are negative and false if all of the days, months and years in the Period are positive.A program that demonstrates this is given as followsExample Live Demoimport java.time.Period; public class Demo { public static void main(String[] args) { String period = "P5Y9M4D"; Period p = Period.parse(period); ... Read More 
Updated on 30-Jul-2019 22:30:25
To find value in the array with multiple criteria, for example, you can use $elemMatch along with $gt and $lt. The syntax is as follows −db.yourCollectionName.find({yourFieldName:{$elemMatch:{$gt:yourNegativeValue, $lt:yourPo sitiveValue}}}).pretty();To understand the above syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.findValueInArrayWithMultipleCriteriaDemo.insertOne({"StudentName":"Larry", "StudentMarks":[-150, 150]}); { "acknowledged" : true, "insertedId" : ObjectId("5c77daf6fc4e719b197a12f5") } > db.findValueInArrayWithMultipleCriteriaDemo.insertOne({"StudentName":"Mike", "StudentMarks":[19]}); { "acknowledged" : true, "insertedId" : ObjectId("5c77db09fc4e719b197a12f6") }Display all documents from a collection with the help of find() method. The query is as follows −> db.findValueInArrayWithMultipleCriteriaDemo.find().pretty();The following is the ... Read More 
Updated on 30-Jul-2019 22:30:25
You can use UPDATE command for this.The syntax is as followsupdate yourTableName set yourColumnName =yourColumnName +yourIntegerValue where ;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table addANumberToCurrentValueDemo -> ( -> Game_Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Game_Score int -> ); Query OK, 0 rows affected (0.67 sec)Now you can insert some records in the table using insert command. The query is as follows −mysql> insert into addANumberToCurrentValueDemo(Game_Score) values(1090); Query OK, 1 row affected (0.30 sec) mysql> insert into addANumberToCurrentValueDemo(Game_Score) values(204); Query OK, ... Read More 
Updated on 30-Jul-2019 22:30:25
An expression tree is basically a binary tree which is used to represent expressions. In expression tree, nodes correspond to the operator and each leaf node corresponds to the operand. This is a C++ program to construct an expression tree for a postfix Expression in inorder, preorder and postorder traversals.AlgorithmBegin Function r() has a character variable as parameter. If the characters are + or - or * or / then Return will be -1 If the characters are from A to Z then Return will ... Read More 
Updated on 30-Jul-2019 22:30:25
seekg() is a function in the iostream library that allows us to seek an arbitrary position in a file. It is mainly used to set the position of the next character to be extracted from the input stream from a given file in C++ file handling.Syntaxistream&seekg(streamoff offset, ios_base::seekdir dir); istream&seekg(streampos position); Where, position: It is the new position in the stream buffer. offset: It is an integer value of type streamoff which represents the offset in the stream’s buffer, relative to the dir parameter. dir: It is the seeking direction. It is an object of type ios_base::seekdir that can take ... Read More 
Updated on 30-Jul-2019 22:30:25
This example demonstrate about how to add list in alert dialogStep 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. In the above code, we have taken text view.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.content.DialogInterface; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { TextView text; @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override ... Read More 
Updated on 30-Jul-2019 22:30:25
To convert integer array list to float array, let us first create an integer array list −ArrayList < Integer > arrList = new ArrayList < Integer > (); arrList.add(25); arrList.add(50); arrList.add(100); arrList.add(200); arrList.add(300); arrList.add(400); arrList.add(500);Now, convert integer array list to float array. We have first set the size to the float array. With that, each and every value of the integer array is assigned to the float array −final float[] arr = new float[arrList.size()]; int index = 0; for (final Integer value: arrList) { arr[index++] = value; }Example Live Demoimport java.util.ArrayList; public class Demo { public static void main(String[] ... Read More 
Updated on 30-Jul-2019 22:30:25
We use the const qualifier to declare a variable as constant. That means that we cannot change the value once the variable has been initialized. Using const has a very big benefit. For example, if you have a constant value of the value of PI, you wouldn't like any part of the program to modify that value. So you should declare that as a const.Objects declared with const-qualified types may be placed in read-only memory by the compiler, and if the address of a const object is never taken in a program, it may not be stored at all. For ... Read More 
Updated on 30-Jul-2019 22:30:25
In this section we will see what is the conversion constructor or converting constructor in C++ class. A constructor is a special type of function of class. It has some unique property like, its name will be same as class name, it will not return any value etc. The constructors are used to construct objects of a class. Sometimes constructors may take some arguments, or sometimes it does not take arguments.When a constructor takes only one argument then this type of constructors becomes conversion constructor. This type of constructor allows automatic conversion to the class being constructed.Example#include using namespace std; ... Read More 
Updated on 30-Jul-2019 22:30:25
Yes, you need to use AND or OR operator. The syntax is as follows −select *from yourTableName where yourColumnName1=yourValue AND yourColumnName=yourValue';For AND condition, both conditions must be true otherwise you will get an empty set.To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table WhereDemo -> ( -> Id int, -> Name varchar(20) -> ); Query OK, 0 rows affected (0.56 sec)Now you can insert some records in the table using insert command. The query is ... Read More Advertisements