Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


sowmya k c
THROWS
1 Answer(s)      2 years and 10 months ago
Posted in : Java Interview Questions


how can we throw unkown exception using throws clause...?


Advertisement
View Answers

October 10, 2011 at 5:59 PM


To throw an exception using throws clause, we have defined a file which is not existed. Here is the code:

import java.io.*;
class  ReadData
{
    public static void main(String[] args) throws Exception
    {   
        BufferedReader br=new BufferedReader(new FileReader("dd.txt"));
        String st;
        while((st=br.readLine())!=null){
            System.out.println(st);
        }
    }
}


Related Tutorials/Questions & Answers:
THROWS
THROWS   how can we throw unkown exception using throws clause...?   To throw an exception using throws clause, we have defined a file... { public static void main(String[] args) throws Exception
Java throw ,throws
Java throw ,throws  What is the difference between throw and throws
Advertisements
Java throw and throws
Java throw and throws  What is the difference between throw and throws
throws example program java
throws example program java  how to use throws exception in java?   The throws keyword is used to indicate that the method raises... static void divide() throws ArithmeticException { int x = 10, y = 0
throws IOException - Java Beginners
throws IOException  throws IOException means   Hi Friend, Most methods of IO class throw an IOException if anything goes wrong. Therefore this block of code is used with the methods that may be having some
throws Exception - RMI
throws Exception  I downloaded your RMI Hello program it works... shows the message the Server is connected, but in Client side it throws... { public HelloImpl() throws RemoteException { super(); } public String
Throw,Throws, n try and Catch
Throw,Throws, n try and Catch  What is the difference between Throw and Throws
Throw,Throws, n try and Catch
Throw,Throws, n try and Catch  what is the difference between Throw,Throws and Try&Catch
throws Java Keyword
throws Java Keyword       throws " is a keyword defined in the java programming language. Keywords... : -- The throws keyword in java programming language is applicable to a method
Spring AOP After Throws Advice
.style1 { background-color: #FFFFCC; } Throws Advice Example This advice is executed when a method throws an exception. To implement throws...(" ******* Inside Throws Advice ******* "); } } AfterThrowingAdviceTest.java
Difference between throw and throws in java.
Difference between throw and throws in java. Throws and throw both... is not able to handle the checked exception, it should declared with throws keyword. Throws can be declared with multiple Exceptions separated with comma. Throw
Clicking F5 and reentering value throws Null pointer exception
Clicking F5 and reentering value throws Null pointer exception  Hi, My page performs search operation.Normally when i enter a value and click on search it fetches a list corresponding to the search value entered by me.But when i
jar file built by ant jar task does not have all the dependant jars and throws exception while reading the appplicationContext,xml
jar file built by ant jar task does not have all the dependant jars and throws exception while reading the appplicationContext,xml  I have a spring class with main method. Inside the class am trying to read the values
Exceptions
Java NotesExceptions Exceptions | Exception Usage | Exceptions - More Java throws an exception When your program causes an error, Java throws an exception. Java then throws this exception to a part of the program
Java throw and throws Keyword Example
Java throw and throws Keyword Example In this section we will read about how to throw the caught exception using throw and throws keywords in Java. throws... throws the exception explicitly whereas the keyword throws declares the exceptions
Exception Handling with and without using try catch block
Description: Without using try catch block. If you do not want to explicitly make try catch block then to you program write throws Exception to your...(String args[]) throws Exception {        
Java AclNotFoundException Class Hierarchy Diagram
In this section we will discuss about the class hierarchy of AclNotFoundException Class in Java. This class extends the java.lang.Exception class. An application throws such exception when tried to make a reference to such ACL (Access
clone method in Java
clone() method in Java is used to create and return copy of the object. Clone() method is used in class where Cloneable interface is implemented but throws a CloneNotSupportedException where a Cloneable interface is not implemented
unchecked exception
unchecked exception  What happens if the service method throws an unchecked Exception
GNIIT/java
GNIIT/java  what is the different between throw and throws
Java exception handling
Java exception handling  What is the difference between throw and throws keywords
java Exception handling - Java Beginners
java Exception handling  what is the difference between throw and throws keywords
Scanner
Scanner  In java,while connectig keyboard through java.util.scanner class..it does not throws IOException..why
Core Java - Java Interview Questions
at a time only one exception we can throw.But throws key word is method signature level it will be send multible Exception to the callerexample:throws:void meth() throws IOException,ServletException{}throw:void meth(){new throw("user
Java Exception - Java Beginners
Java Exception  Why we are using throws in the java program even if we have try...catch block? If throws will throw the exception then who will catch it? what is the difference between the throw & throws?   Hi Friend
jdbc - JDBC
JDBC Query to Connect Database  JDBC Query to connect to database  will u supply me the block of code where it throws the exception
EXCEPTIONS-----1 - Java Interview Questions
EXCEPTIONS-----1  How To Handle The Exceptions With Out Using Try,Catch And Throws?I Want Region Plz Post Answer
Java Inheritance - Java Beginners
then instead of using throws IOException why not use throws Object? import java.io.*; class Test { public static void main(String[] args) throws Object
Java I/O Object Streams
of bytes.int available() throws IOException close() : This method is used to close the input stream.void close() throws IOException read() : This method is used to read the data's byte.int read() throws IOException read(byte[] b
java bits 4 - Java Interview Questions
. B. The code on line 33 throws an exception. C. The code on line 35 throws an exception. D. The code on line 31 throws an exception. E. The code on line 33
EXCEPTIONS - Java Interview Questions
throws clause.For ex: class MyException extends Exception { public...(int first,int second) throws MyException{ if(second==0) throw new... void main(String[] args)throws MyException { System.out.println(divide(4,0
SCJP Module-6 Question-2
void Function(Ingredient[] list) throws XXX 3.  {     //body of the Function N.  } } The code above throws two... void Function(Ingredient[] list) throws BaseException 2. public void
java
java  1.Create a class Errorhandle1. Write code that deliberately throws the following exceptions, without using the √Ę‚?¨Ň?throw√Ę‚?¨¬? keyword ClassCastException NullPointerException ArrayIndexOutOfBoundsException
exception
exception  1.Create a class Errorhandle1. `Write code that deliberately throws the following exceptions, without using the ‚??throw‚?? keyword : ClassCastException NullPointerException ArrayIndexOutOfBoundsException
continuing execution after an exception is thrown
continuing execution after an exception is thrown  If while executing a statement in a try say the second statement, if it throws an exception, is it possible to handle that exception and then continue on with the remaining
JTree -Swings
JTree -Swings  how to update a single node in a siteTree though there are more than one node.? it throws exception when we try to update the site tree when the change is on only one node
Reflection api :Invocation target exception - JDBC
Reflection api :Invocation target exception   Am using a function to insert a record into the database .Using reflection api am invoking it,but it throws a class not found : oracle.jdbc.driver.oracledriver exception
Identify correct and incorrect statements or examples about the client view of a session bean's local and remote component interfaces.
() throws RemoteException; Handle getHandle() throws RemoteException; Object getPrimaryKey() throws RemoteException; boolean isIdentical(EJBObject obj) throws RemoteException; void remove() throws RemoteException, RemoveException
throw Java Keyword
lying among the multiple catch blocks. -- If any method throws an exception which... the exceptions it throws using a throws modifier on the method declaration... Class1{ public method readtheFile(String file) throws
Java I/O Buffered Streams
stream. public int available() throws IOException close... to the stream get released. public void close() throws IOException  ... read() throws IOException   read(byte[] b, int off
why alert box is not appearing in servlets...?
) throws ServletException { super.init(config); } public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
Threads
Threads   public class P3 extends Thread{ void waitForSignal() throws InterruptedException { Object obj = new Object...) throws InterruptedException { P3 t=new P3
core java - Java Beginners
core java  Diff b/w Throws and Throw  Hi Friend, Please visit the following link: http://www.roseindia.net/java/exceptions/how... explicitly throws is a cluase and it is another type mechanism for handling
Exception - Java Beginners
Exception  plz explain to me with an example the use of try catch,throw and throws in java. void accept() throws IOException can a catch statement follow this method to handle IOException?if not where is it handled?  
ejb - EJB
ejb  import java.rmi.*; import java.ejb.*; public interface hellohome1 extends EJBHome { HelloRemote create() throws CreateException... create() throws CreateException, RemoteException
java Exception handling - Java Beginners
java Exception handling  what is the difference between throw and throws keywords  Hi Friend, The keyword throw is used to throw an exception manually where as throws is used in the case of checked exceptions to re
Identify correct and incorrect statements or examples about the client view of a entity bean's remote component interface (EJBObject).
javax.ejb.EJBObject { void debit(double amount) throws java.rmi.RemoteException, InsufficientBalanceException; void credit(double amount) throws java.rmi.RemoteException; double getBalance() throws java.rmi.RemoteException
 

 

 

DMCA.com