Home

Throws

Throws has multiple meanings across domains. In everyday language, it is the present tense of the verb to throw. In sports, throws refers to the group of events known as throwing events, including shot put, discus, hammer, and javelin. In competition, athletes aim to propel an implement as far as possible from a throwing circle or runway, and distances are measured from release to landing along a straight line. Records are kept for each event, and technique, strength, and wind conditions can influence results.

In computing, throws is a keyword associated chiefly with Java. It is used in a method declaration

See also: throwing (sports), exception handling, Java (programming language).

to
indicate
that
the
method
may
throw
checked
exceptions.
For
example,
a
signature
such
as
public
void
read()
throws
IOException
declares
that
an
IOException
might
be
propagated
to
the
caller.
The
throw
statement,
by
contrast,
is
the
action
that
actually
raises
an
exception.
The
distinction
matters
because
checked
exceptions
must
be
either
caught
or
declared
by
callers,
whereas
unchecked
exceptions
do
not
require
handling.
Some
languages
have
different
or
deprecated
mechanisms;
for
instance,
C++
once
supported
exception
specifications
like
throw(),
but
these
have
fallen
out
of
use,
and
modern
C++
relies
on
noexcept
and
standard
exception
types.
Kotlin
and
Scala
provide
interoperability
features
that
allow
declaring
exceptions
for
Java
code,
often
via
annotations
such
as
@Throws.