Skip Finally Block Even if Exception Occurs in Java

Maruthi Krishna
Updated on 03-Jul-2020 08:07:01

5K+ Views

An exception is an issue (run time error) occurred during the execution of a program. When an exception occurred the program gets terminated abruptly and, the code past the line that generated the exception never gets executed.Try, catch, finally blocksTo handle exceptions Java provides a try-catch block mechanism.A try/catch block is placed around the code that might generate an exception. Code within a try/catch block is referred to as protected code.Syntaxtry {    // Protected code } catch (ExceptionName e1) {    // Catch block }When an exception raised inside a try block, instead of terminating the program JVM stores ... Read More

Maximum Size Rectangle Binary Sub-Matrix with All 1s in C++

Ayush Gupta
Updated on 03-Jul-2020 08:06:57

197 Views

In this tutorial, we will be discussing a program to find maximum size rectangle binary sub-matrix with all 1s.For this we will be provided with 2D matrix containing zeroes and ones. Our task is to find the largest 2D matrix subset containing only ones.Example Live Demo#include using namespace std; #define R 4 #define C 4 //finding the maximum area int maxHist(int row[]) {    stack result;    int top_val;    int max_area = 0;    int area = 0;    int i = 0;    while (i < C) {       if (result.empty() || row[result.top()]

Create a Transition Effect on Hover Pagination with CSS

Anvi Jain
Updated on 03-Jul-2020 08:06:04

544 Views

To create a transition effect on hover pagination, use the transition property.ExampleYou can try to run the following code to add transition effect −Live Demo                    .demo {             display: inline-block;          }          .demo a {             color: red;             padding: 5px 12px;             text-decoration: none;             border-radius: 5px;             transition: background-color 2s;          }          .demo a.active {             background-color: orange;             color: white;             border-radius: 5px;          }          .demo a:hover:not(.active) {             background-color: yellow;          }                     Our Quizzes                          

CSS Grid Template Columns Property

Nishtha Thakur
Updated on 03-Jul-2020 08:05:30

84 Views

The grid-template-columns property is used to set the number of columns in the Grid.ExampleYou can try to run the following code to implement the grid-template-columns property −Live Demo                    .container {             display: grid;             background-color: blue;             grid-template-columns: auto auto;             padding: 20px;             grid-gap: 20px;          }          .container > div {             background-color: orange;             border: 2px solid gray;             padding: 35px;             font-size: 30px;             text-align: center;          }                     Game Board                1          2          3          4          5          6          

Resume Java Execution After Exception Occurs

Maruthi Krishna
Updated on 03-Jul-2020 08:05:25

6K+ Views

An exception is an issue (run time error) occurred during the execution of a program. When an exception occurred the program gets terminated abruptly and, the code past the line that generated the exception never gets executed.There are two types of exceptions in Java.Unchecked Exception − An unchecked exception is the one which occurs at the time of execution. These are also called as Runtime Exceptions. These include programming bugs, such as logic errors or improper use of an API. Runtime exceptions are ignored at the time of compilation.Checked Exception − A checked exception is an exception that occurs at ... Read More

Vertically Align Grid Inside Container with CSS

Jennifer Nicholas
Updated on 03-Jul-2020 08:04:37

134 Views

You can try to run the following code to vertically align the grid using the align-content property −ExampleLive Demo                    .container {             display: grid;             background-color: gray;             align-content: center;             padding: 20px;             grid-gap: 20px;          }          .container > div {             background-color: orange;             border: 2px solid gray;             padding: 35px;             font-size: 30px;             text-align: center;          }                     Game Board                1          2          3          4          5          6          

Add Rounded Borders to First and Last Link in Pagination Using CSS

Nancy Den
Updated on 03-Jul-2020 08:03:19

501 Views

To add rounded borders, use the border-radius property. For top/ bottom left, use the border-top-left-radius property and for bottom, use border-bottom-left-radius. In the same way, set for top/bottom right.ExampleYou can try to run the following code to add rounded borders to first and last link in the pagination −Live Demo                    .demo {             display: inline-block;          }          .demo a {             color: red;             padding: 5px 12px;   ... Read More

Decide if Custom Exception Should be Checked or Unchecked in Java

Maruthi Krishna
Updated on 03-Jul-2020 08:02:42

6K+ Views

An exception is an issue (run time error) occurred during the execution of a program. When an exception occurred the program gets terminated abruptly and, the code past the line that generated the exception never gets executed.User defined exceptionsYou can create your own exceptions in Java and they are known as user defined exceptions or custom exceptions.To create a user defined exception extend one of the above mentioned classes. To display the message override the toString() method or, call the superclass parameterized constructor by passing the message in String format.MyException(String msg){    super(msg); } Or, public String toString(){    return ... Read More

Maximum Size of Sub-array that Satisfies the Given Condition in C++

Ayush Gupta
Updated on 03-Jul-2020 08:02:35

190 Views

In this tutorial, we will be discussing a program to find maximum size of sub-array that satisfies the given condition.For this we will be provided with an array of integers. Our task is to find the maximum length subset of that array satisfying either of arr[k] > arr[k + 1] when k is odd and arr[k] < arr[k + 1] when k is even, arr[k] > arr[k + 1] when k is even and arr[k] < arr[k + 1] when k is odd.Example Live Demo#include using namespace std; //comparing values of a and b int cmp(int a, int b) {   ... Read More

Play Ringtone, Alarm, and Notification Sound in Android

George John
Updated on 03-Jul-2020 08:02:25

3K+ Views

This example demonstrate about How to play ringtone/alarm/notification sound in Android.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.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme; import android.app.NotificationManager; import android.content.Context; import android.media.MediaPlayer; import android.media.RingtoneManager; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import java.util.Objects; public class MainActivity extends AppCompatActivity {    private final static String default_notification_channel_id = "default";    @Override    protected void onCreate (Bundle ... Read More

Advertisements