Java
T
point
Home
Python
Java
JavaScript
HTML
SQL
PHP
C#
C++
DS
Aptitude
Reasoning
Selenium
DBMS
C
Android
Interview Q
Content Menu ▼
1
2
3
4
5
6
7
8
9
10
Question 1
:
Which of the following is a correct outline of a method that throws an exception when it finds a problem?
1.
public void someMethod ()
{
...
if ( problem )
throw new Exception("Useful Message");
...
}
2.
public void someMethod () throws Exception
{
...
if ( problem )
Exception("Useful Message");
...
}
3.
public void someMethod () throws Exception
{
...
if ( problem )
throw( new Exception("Useful Message") );
...
}
4.
public void someMethod () throws Exception
{
...
if ( problem )
throw new Exception("Useful Message");
...
}