Daniol Thomas has Published 212 Articles

C++ Program to Implement Sieve of eratosthenes to Generate Prime Numbers Between Given Range

Daniol Thomas

Daniol Thomas

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

2K+ Views

This is C++ program to implement Sieve of Eratosthenes to Generate Prime Numbers Between Given Range. In this method, an integer array with all elements initializes to zero.It follows where each non-prime element’s index is marked as 1 inside the nested loops. The prime numbers are those whose index is ... Read More

MonthDay getMonth() method in Java

Daniol Thomas

Daniol Thomas

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

160 Views

The month name for a particular MonthDay can be obtained using the getMonth() method in the MonthDay class in Java. This method requires no parameters and it returns the month name in the year.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; public class Demo {    public ... Read More

MonthDay getMonthValue() method in Java

Daniol Thomas

Daniol Thomas

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

50 Views

The month of the year is obtained using getMonthValue() method in the MonthDay class in Java. This method requires no parameter and it returns the month of the year which may be in the range of 1 to 12.A program that demonstrates this is given as followsExample Live Demoimport java.time.*; public ... Read More

MonthDay getLong() method in Java

Daniol Thomas

Daniol Thomas

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

49 Views

The long value of a specified Chronofield can be obtained using the getLong() method in the MonthDay class in Java. This method requires a single parameter i.e. the ChronoField and it returns the long value of a specified Chronofield.A program that demonstrates this is given as followsExample Live Demoimport java.util.*; import ... Read More

Period withMonths() method in Java

Daniol Thomas

Daniol Thomas

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

109 Views

An immutable copy of a Period with the number of months as required is done using the method withMonths() in the Period class in Java. This method requires a single parameter i.e. the number of months in the Period and it returns the Period with the number of months as ... Read More

How to perform custom sort by field value in MySQL?

Daniol Thomas

Daniol Thomas

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

91 Views

To perform custom sort by field value in MySQL, use the FIELD() method in ORDER BY. Let us first create a table:mysql> create table DemoTable (StudentId int); Query OK, 0 rows affected (0.58 sec)Following is the query to insert some records in the table using insert command:mysql> insert into DemoTable ... Read More

How to create Tab Delimited Select statement in MySQL?

Daniol Thomas

Daniol Thomas

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

648 Views

To create a tab delimited select statement, you can use CONCAT() function from MySQL. Following is the syntax:select concat(yourColumnName1, "\t", yourColumnName2) AS anyAliasName from yourTableName;Let us first create a table:mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    FirstName varchar(20),    LastName varchar(20) ); Query ... Read More

Selecting a column that is also a keyword in MySQL?

Daniol Thomas

Daniol Thomas

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

6K+ Views

To select a column that is also a keyword in MySQL, you need to use backticks around the column name. As you know select is a keyword in MySQL, consider column name as select when creating a new table.Let us create a table:mysql> create table DemoTable (`select` varchar(100)); Query OK, ... Read More

Can we call functions using Callable Statements? Explain with an example in JDBC?

Daniol Thomas

Daniol Thomas

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

2K+ Views

Like procedures, you can also create function in a database and store them.SyntaxFollowing is the syntax of creating a function in a(MySQL) database:CREATE FUNCTION Function_Name(input_arguments) RETURNS output_parameter BEGIN    declare variables;    statements . . . . . . . . . .    return data_type;    ENDExampleSuppose we have ... Read More

StringJoiner length() method in Java 8

Daniol Thomas

Daniol Thomas

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

171 Views

The length() method of the StringJoiner class in Java 8 is used to get the length of the current value of StringJoiner.To work with the StringJoiner in Java 8, import the following package:import java.util.StringJoiner;The syntax is as follows:public int length()First, create a StringJoiner:StringJoiner strJoin = new StringJoiner(", "); strJoin.add("US"); strJoin.add("India"); ... Read More

Advertisements