Fastest Ball in the History of Cricket

Vihan Rodrigues
Updated on 30-Jul-2019 22:30:24

590 Views

When we hear the fastest ball, the fierce faces of all fast bowlers and their tough looks start striking our mind. It includes Wasim Akram, Courtney Walsh, Chaminda Vaas, Umar Gul, etc. But the question still remains unanswered that who among the fast bowler fraternity has done this miracle.Well, the answer is Shoaib Akhtar who is recognized as the fastest bowler in the history of cricket by delivering an officially recorded top speed of 163.3 km/h in a pool match against England during the 2003 Cricket World Cup. Unfortunately, Akhtar did not get any wicket on the ball.Fastest Recorded Deliveries ... Read More

Default Access Level in Java

Jai Janardhan
Updated on 30-Jul-2019 22:30:24

658 Views

The default access level is available when no access level is specified. All the classes, data members, methods etc. which have the default access level can only be accessed inside the same package.A program that demonstrates the default access level in Java is given as follows:Example Live Democlass Employee {    int empno;    String name;    void insert(int e, String n) {       empno = e;       name = n;    }    void display() {       System.out.println("Employee Number: " + empno);       System.out.println("Name: " + name);    } } public class ... Read More

What is a Sonnet in English Literature

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

555 Views

A small lyric poem of fourteen lines is a sonnet. There are two types of Sonnets: the Italian (Petrarchan) and the English (Shakespearean).In the Italian form, There are two intrinsic divisions: the first part consists of 8 lines and the second part is of 6 lines, in all making 14 lines.Shakespearian SonnetsBut the same does not happen in Shakesperian sonnets. William Shakespeare, the ‘Bard of Avon’, is noted to have mastered at least 38 plays, 154 sonnets, two long narrative poems, and a few other verses. His popularity can be estimated by the following “He was naturally learned; he needed ... Read More

Retrieve the Last Entry in a TreeMap in Java

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

2K+ Views

Use the lastEntry() method in TreeMap to retrieve the last entry.Create a TreeMap and add some elements −TreeMap m = new TreeMap(); m.put(1, "India"); m.put(2, "US"); m.put(3, "Australia"); m.put(4, "Netherlands"); m.put(5, "Canada");Now, retrieve the last entry −m.lastEntry()The following is an example to retrieve last entry in the TreeMap −Example Live Demoimport java.util.*; public class Demo {    public static void main(String args[]) {       TreeMap m = new TreeMap();       m.put(1, "India");       m.put(2, "US");       m.put(3, "Australia");       m.put(4, "Netherlands");       m.put(5, "Canada");       for(Map.Entry e:m.entrySet()) ... Read More

Use of Import Statement in Java

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

4K+ Views

The import statement can be used to import an entire package or sometimes import certain classes and interfaces inside the package. The import statement is written before the class definition and after the package statement(if there is any). Also, the import statement is optional.A program that demonstrates this in Java is given as follows:Example Live Demoimport java.util.LinkedList; public class Demo {    public static void main(String[] args) {       LinkedList l = new LinkedList();       l.add("Apple");       l.add("Mango");       l.add("Cherry");       l.add("Orange");       l.add("Pear");       System.out.println("The ... Read More

Change Year of Dates in MySQL from 2020 to 2011

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

531 Views

You can change year of dates from 2020 to 2011 using SUBDATE() with INTERVAL of 9 year because there is a difference of 9 years between 2020 to 2011.The syntax is as follows:UPDATE yourTableName SET yourDateColumnName=SUBDATE(yourDateColumnName, INTERVAL 9 YEAR);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table ChangeYearFrom2020To2011    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> ExpiryDate date,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command. The query to insert ... Read More

Programmatically Restart an Android App

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

3K+ Views

There are some situations, we need to restart whole application programmatically. This example demonstrates how do I programmatically “restart” an Android app.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.     In the above code, we have taken a text view. When the user clicks on text view, it will restart the whole application.package com.example.andy.myapplication; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; ... Read More

Phone Number Validation Using Java Regular Expressions

Jai Janardhan
Updated on 30-Jul-2019 22:30:24

3K+ Views

The phone number can be validated using the java.util.regex.Pattern.matches() method. This method matches the regular expression for the phone number and the given input phone number and returns true if they match and false otherwise.Note: We are considering a demo number for our example since we cannot use our phone number publicly.A program that demonstrates this is given as follows:Example Live Demopublic class Demo {    public static void main(String args[]) {       String phoneNumber = "9999999998";       String regex = "(0/91)?[7-9][0-9]{9}";       System.out.println("The phone number is: " + phoneNumber);       System.out.println("Is the ... Read More

Fill Elements in a Java Double Array in a Specified Range

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

332 Views

Elements can be filled in a Java double array in a specified range using the java.util.Arrays.fill() method. This method assigns the required double value in the specified range to the double 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

Zip Code Validation Using Java Regular Expressions

Arushi
Updated on 30-Jul-2019 22:30:24

2K+ Views

The zip code can be validated using the java.util.regex.Pattern.matches() method. This method matches the regular expression for the zip code and the given input zip code and returns true if they match and false otherwise.A program that demonstrates this is given as follows:Example Live Demopublic class Demo {    public static void main(String args[]) {       String zipCode = "83592-1537";       String regex = "\d{5}(-\d{4})?";       System.out.println("The zip code is: " + zipCode);       System.out.println("Is the above zip code valid? " + zipCode.matches(regex));    } }OutputThe zip code is: 83592-1537 Is the above ... Read More

Advertisements