Nishtha Thakur has Published 564 Articles

override Keyword in C++

Nishtha Thakur

Nishtha Thakur

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

4K+ Views

The function overriding is the most common feature of C++. Basically function overriding means redefine a function which is present in the base class, also be defined in the derived class. So the function signatures are the same but the behavior will be different.But there may be a situation when ... Read More

How to set values to list of parameters of IN clause on PreparedStatement using JDBC?

Nishtha Thakur

Nishtha Thakur

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

4K+ Views

The IN clause in MYSQL database is used to specify the list of parameters in a query.For example, you need to retrieve contents of a table using specific IDs you can do so using the SELECT statement along with the IN clause as −mysql> SELECT * from sales where ID ... Read More

Private Destructor in C++

Nishtha Thakur

Nishtha Thakur

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

590 Views

Here we will see what will be the case if the destructors are private in C++. Let us see some example codes to get the idea.This code has private destructor, but it will not generate any error because no object is created.Example#include using namespace std; class my_class {   ... Read More

Java Program to change the background color of rows in a JTable

Nishtha Thakur

Nishtha Thakur

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

804 Views

To change the background color of rows, you need to use the setBackground() method −JTable table = new JTable(marks, col); table.setBackground(Color.blue);Above, we have set the color using Color class −Color.blueThe following is an example to change the background color of rows −Examplepackage my; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import ... Read More

How to check if a field in MongoDB is [] or {}?

Nishtha Thakur

Nishtha Thakur

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

115 Views

To check if a field in MongoDB is [] or {}, you can use the following syntax −db.yourCollectionName.find({    "yourOuterFieldName": { "$gt": {} },    "yourOuterFieldName.0": { "$exists": false } });Let us first create a collection with documents -> db.checkFieldDemo.insert([ ...   { _id: 1010, StudentDetails: {} }, ...   ... Read More

How to pass a value in where clause on PreparedStatement using JDBC?

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

To execute a statement with Where clause using PreparedStatement. Prepare the query by replacing the value in the clause with place holder “?” and, pass this query as a parameter to the prepareStatement() method.String query = "SELECT * FROM mobile_sales WHERE unit_sale >= ?"; //Creating the PreparedStatement object PreparedStatement pstmt ... Read More

Extending namespace and Unnamed namespace

Nishtha Thakur

Nishtha Thakur

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

192 Views

Here we will see how we can extend some namespace, and how the unnamed or anonymous name space can be used.Sometimes we can define one namespace. Then we can write the namespace again with the same definition. If the first one has some member, and second one has some other ... Read More

How to change notification background colour in Android?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

This example demonstrate about How can I marquee the text content in Android Notification.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

MongoDB pull with positional operator?

Nishtha Thakur

Nishtha Thakur

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

92 Views

Use $pull operator along with positional operator($) in MongoDB. Let us first create a collection with documents −> db.pullWithPositionalOperatorDemo.insertOne( ...   { ...      _id: 100, ...      "StudentDetails": [ ...         { ...            "StudentId": "STU-1", ...       ... Read More

How to store decimal values in a table using PreparedStatement in JDBC?

Nishtha Thakur

Nishtha Thakur

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

964 Views

To insert records into a table that contains a decimal value using PreparedStatement you need to −Register the driver − Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Establish a connection − Connect ot the database using the ... Read More

Advertisements