Questions tagged [throw]

throw is a keyword in various languages used for signaling an exception.

By throwing an exception the normal flow of control of a program gets interrupted. If this happens inside a try-block execution continues inside a matching catch or finally block, like in the following Java example:

try { 
    throw new RuntimeException("for demonstrating try-throw-catch");
    System.out.println("this doesn't get executed")
} catch (RuntimeException re) {
    System.out.println("flow of control goes directly here");
}

Use this tag for questions about the process or syntax of throwing exceptions.

Prefer for questions about the declaration of exceptions thrown by a method

Use or for questions about the catching side of the exception handling.

and for questions about the complete process of exception handling.

886 questions
-5
votes
1 answer

Throws keyword in C++

Can someone point the right way to do this program with exception handling? It is a program for stacks. 1)#include 2)#include 3)#include 4)using namespace std; 5) 6)template 7)class Stack { 8)private: 9) int…
Fox
  • 9,384
  • 13
  • 42
  • 63
1 2 3
59
60