Get Month Value Using MonthDay in Java

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

88 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 class Demo {    public static void main(String[] args) {       MonthDay md = MonthDay.parse("--02-22");       System.out.println("The MonthDay is: " + md);       System.out.println("The month is: " + md.getMonthValue());    } }OutputThe MonthDay is: --02-22 The month is: 2Now let us understand the above ... Read More

Instant plusNanos Method in Java

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

114 Views

An immutable copy of a instant where some nanoseconds are added to it can be obtained using the plusNanos() method in the Instant class in Java. This method requires a single parameter i.e. the number of nanoseconds to be added and it returns the instant with the added nanoseconds.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo {    public static void main(String[] args) {       Instant i = Instant.now();       System.out.println("The current instant is: " + i);       System.out.println("An instant with 1000000000 nanoseconds added is: " + ... Read More

Restart MySQL Server

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

1K+ Views

Restart the MySQL Server with the help of restart command.The syntax is as followsRestartLet us first check the MySQL version.The query is as followsSELECT version();Now, implement the above command in order to restart the MySQL Server.The query is as followsmysql> restart; Query OK, 0 rows affected (0.00 sec)Case 1Now, MySQL Server is being restarted. If you try to perform any query during the restart command, you will get an error.The query is as followsmysql> show databases; ERROR 2013 (HY000): Lost connection to MySQL server during queryCase 2If the MySQL restart process is complete, then a new connection id will be ... Read More

Get Last Access and Write Time of a MySQL Database

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

1K+ Views

To get the last access time, try the following syntax −SELECT update_time FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'yourDatabaseName' AND table_name = 'yourTableName'The above syntax gives the last access information about MyISAM engine type.Here, our database is ‘business’ and we will be using the table with the name ‘twoprimarykeytabledemo'.To get last access time of MySQL database, use the following query.Case 1 − The query is as follows −mysql> SELECT update_time    -> FROM INFORMATION_SCHEMA.TABLES    -> WHERE table_schema = 'business'    -> AND table_name = 'twoprimarykeytabledemo';The output is as follows −+---------------------+ | UPDATE_TIME ... Read More

Check If a Table Exists in MySQL

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

909 Views

In order to check a table exists in MySQL, you can use INFORMATION_SCHEMA.TABLES. Let us first create a table −mysql> create table Client_information    -> (    -> Id int,    -> Name varchar(10)    -> ); Query OK, 0 rows affected (0.48 sec)Following is the query to insert some records in the table using insert command −mysql> insert into Client_information values(1, 'Larry'); Query OK, 1 row affected (0.14 sec) mysql> insert into Client_information values(2, 'Mike'); Query OK, 1 row affected (0.17 sec) mysql> insert into Client_information values(3, 'Sam'); Query OK, 1 row affected (0.19 sec)Following is the ... Read More

Extract Values from HashMap in Java

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

2K+ Views

To extract values from HashMap, let us first create a HashMap with keys and values −HashMapm = new HashMap();Now, add some elements to the HashMap −m.put(10, 20); m.put(30, 40); m.put(50, 60); m.put(70, 80); m.put(90, 100); m.put(110, 120); m.put(130, 140); m.put(150, 160);Now, extract the values from the HashMap −for (Integer i: m.keySet()) {    System.out.println(m.get(i)); }Example Live Demoimport java.util.HashMap; public class Demo {    public static void main(String args[]) {       HashMapm = new HashMap();       m.put(10, 20);       m.put(30, 40);       m.put(50, 60);       m.put(70, 80);       m.put(90, 100); ... Read More

Convert Date from DD-MM-YYYY to YYYYMMDD in MySQL

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

2K+ Views

To convert date from 'dd/mm/yyyy' to 'yyyymmdd', you can use the date_format() method. Let us first create a table −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Admissiondate varchar(200) ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Admissiondate) values('21/10/2014'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable(Admissiondate) values('01/12/2016'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(Admissiondate) values('31/01/2017'); Query OK, 1 row affected (0.14 sec)Following is the query to display all records from the table using select statement ... Read More

Multiply Two 8-Bit Numbers Using Shift and Add Method in 8085

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

5K+ Views

Now let us see a program of Intel 8085 Microprocessor. In this program we will see how to multiply two numbers using shift and add methods.Problem Statement:Write 8085 Assembly language program to multiply two 8-bit numbers using shift and add method.Discussion:The shift and add method is an efficient process. In this program, we are taking the numbers from memory location 8000H and 8001H. The 16 bit results are storing into location 8050H onwards.In this method we are putting the first number into DE register pair. The actual number is placed at E register, and D is holding 00H. The second ... Read More

Data Transfer Schemes in 8085

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

13K+ Views

At the time of executing one 8085 program, interruption can be done in the mid-way by the virtue of the program by an Input Output device. Interruption can be done by the method according to which the processor works, since it wants urgent communication with the processor. The data transfer schemes always want for sending information to the processor, rather receiving information from the 8085 processor. It is so because sending and receiving information in the entire 8085 data transfer scheme process plays a vital role for executing the entire program rather process.The communication is not done directly with the ... Read More

When to Use Static Cast, Dynamic Cast, Const Cast, and Reinterpret Cast

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

428 Views

const_castcan be used to remove or add const to a variable. This can be useful if it is necessary to add/remove constness from a variable.static_castThis is used for the normal/ordinary type conversion. This is also the cast responsible for implicit type coercion and can also be called explicitly. You should use it in cases like converting float to int, char to int, etc.dynamic_castThis cast is used for handling polymorphism. You only need to use it when you're casting to a derived class. This is exclusively to be used in inheritance when you cast from base class to derived class.reinterpret_castThis is ... Read More

Advertisements