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



Home Answers Viewqa Java-Beginners Creating Exception
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


siddharthan
Creating Exception
1 Answer(s)      3 years and 10 months ago
Posted in : Java Beginners


class Myexception extends Exception{
private int detail;
Myexecption(int a){
detail=a;
}
public String toString(){
return "Myexception["+detail+"]";
}
}

class Exceptiondemo{
static void Compute(int a) throws Myexception{
System.out.println("Called compute("+a+")");
if(a>10) throw new Myexception(a);
System.out.println("Normal Exit");
}
public static void main(String args[]){
try{
Compute(1);
Compute(20);
}catch(Myexception e){
System.out.println("Caught"+e);
}
}
}

hi to all please help me friends here i created my own exception(Myexception), but its showing invalid method declaration; return type required for Myexception(int a).and thank in advance friendss. Happy new year


Advertisement
View Answers

January 1, 2011 at 4:56 PM


Hi,

Read at Java Exception examples.

Thanks



Related Tutorials/Questions & Answers:
Creating Exception
Creating Exception  class Myexception extends Exception{ private int... exception(Myexception), but its showing invalid method declaration; return type...   Hi, Read at Java Exception examples. Thanks
Exception
Exception   I was creating a table dynamically but it shows exception i.e shown down Suplier created0 Suplier created0 Suplier created0 Product created0 Product created0 Product created0 Product created0 could not fetch initial
Advertisements
exception
exception  wHEN RUNTIME EXCEPTION CLASS IS SUB OF EXCEPTION CLASS HOW CAN'T HANDLE UNCHECKED EXCEPTION
exception
exception  chek in and check out exception in java   Please visit the following link: Checked and Unchecked Exception
exception
arguments are not equalto two,throw a user defined exception "invalid parameter exception" ,otherwise display the two parameters.   Here is an example... is not equal to two then invalid parameter exception is thrown ,otherwise display the two
exception
exception  what is the use of catch block even though we have predefined exception object
exception
defined checked exception ââ?¬Ĺ?InvalidCharcterFoundExceptionââ?¬Â? and creater a block of codes that will handle the exception
exception
exception  example for numberformat exception   Hi Friend, Try the following code: class NumberFormatExceptionEx{ public static void...); } catch(Exception e){ System.out.println(e
Exception
Exception  whis is the Arithmetic Exception in java? or define Arithmetic Exception with exp?   Arithmetic Exception occurs, when you divide a number by zero. Example public class TryCatch { public static void main
Exception
Exception  public class FooException extends Exception { public..."); } public void calculate() throws FooException, Exception { try { int.... ex.printStackTrace(); System.exit(1); } catch(Exception ex
exception
user defined unchecked exception  can we create user defined unchecked exceptions? if so what is the exact use of it in real time?   Please visit the following links: http://www.roseindia.net/java/java-exception/user
exception
exception  Identify the reason for SQLException exception, which is encountered when the developer tries to run the following code snippet to insert..."); ps.executeUpdate(); } catch(Exception e
custom exception
custom exception  Explain the process of creating custom exception and handling it.   Please visit the following link: Making custom exception
Creating an Applet
Creating an Applet  Hi, I have get a task regarding Creating an Applet using all Layout Manager, can anyone help me in this regard. I donâ??t know how to make and please help me. Thanks.   To answer of your query
Creating Views
Creating Views Struts provides their own JSP tag library for creating view. For using those library you need to import them on your page as <%@taglib... data by model and handle them appropriately. For creating a view you should
exception handling
exception handling  explain about exception handling
Exception handling
Exception handling  how to resolve file not found error exception
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling   Give the exception hierarchy of Java.   Please visit the following links: http://www.roseindia.net/java/java-exception/exception-java.shtml http://www.roseindia.net/java/exceptions/exception
java exception
java exception   define an exception called no match exception tat z... { public static void main(String[] args) throws Exception { String z="Hello"; if(!z.equals("India")){ throw new Exception
Exception Handling
Exception Handling  create an exception class, which thros an exception if operand is non-numeric in claculating modules. ( Use command line arguments
 

 

 

DMCA.com