Setup file

Ads

 
 

Share on Google+Share on Google+

sushant
Setup file
1 Answer(s)      7 years ago
Posted in : Java Beginners
Ads
View Answers

July 20, 2009 at 3:43 PM


Hi Friend,

Whenever we want to force an exception then we use throw keyword. The throw keyword is used to force an exception. It can also pass a custom message to your exception handling module. Moreover throw keyword can also be used to pass a custom message to the exception handling module i.e. the message which we want to be printed. For instance in the above example we have used -

throw new Exception ("can't be divided by zero");

Whereas when we know that a particular exception may be thrown or to pass a possible exception then we use throws keyword. Point to note here is that the Java compiler very well knows about the exceptions thrown by some methods so it insists us to handle them. We can also use throws clause on the surrounding method instead of try and catch exception handler. For instance in the above given program we have used the following clause which will pass the error up to the next level -

static int divide(int first,int second) throws Exception{

For more information,please visit the following link:

http://www.roseindia.net/java/exceptions/how-to-throw-exceptions.shtml

Thanks

Ads









Related Tutorials/Questions & Answers:
Creating a setup file
Creating a setup file  How to create a setup file in tomcat as done in visual studio... could plz tell me as early as possible
Setup file - Java Beginners
Setup file  Hello sir ,how i can make Java Programs Set up File ,Please give me steps to make that. & What is the difference between Throw and Throws,Can U give me Simple code to Differ Throw and Throws ?  Hi Friend
Advertisements
Setup in Java
Setup in Java  Hello I want to know that how to create make setup in java of a java program or jFrame applicatio or Applet.Plz give answer ASAP. Thanks & Regards Sunil Kumar
Setup validator framework in Struts
Setup validator framework in Struts  How to Setup validator framework in Struts
installation and setup problem - Java Beginners
installation and setup problem  Hi, Iam new to java.Can any one tell me about how to install tomcat5.5 and set up in my windows xp operating system in detail? Thanks in advance
Setup Hibernate Environment
Setup Hibernate Environment - Learn how to setup Hibernate Development... the file hibernate-release-4.2.8.Final.zip. It includes the libraries... the downloaded file (hibernate-release-4.2.8.Final.zip) into a directory and then unzip
How to setup Apache Spark Development Environment?
Getting started with Spark Framework: How to setup the development... to configure all the necessary software to setup development environment... will need to setup the development environment with Apache Spark. JDK
EJB Deployment how to create a simple ejd session bean and how to do project setup
to do project setup...? please help me i am getting difficult
File
File  How to create .Exe file in jana
file
file  how can copy the information in the file to the string?   Store file data into String
file
file  Could anyone please help me to write a code that does the following: Opens a file named MyName.txt, reads the first line from the file and displays it, and then closes the file. Thank you so much
file
file  Hi,what can delet some of the information of the file
file
file  Hi,how can delet some of the information of the file
file
file  how can add the information to the graphic file
FILE
FILE  There is a file named Name.txt that contains information related to appliances.I want to read the contents of this file and I used the code... args[]) { try { File file=new File("Name.txt"); FileReader f=new FileReader(file
File
File   How to find all files in our local computer using java
file
file  hi i want read special line of file. what am i doing ? I write... read data from file. please help me! void maketree(BtNode root,int i) throws... at the following link: Read specific line from file
To make java exe or runnable file
To make java exe or runnable file   Helo sir i make a java application.I need to help how run application direct in pc i.e how it packaged, .exe file or setup file
Setup MySQL Database
Setup MySQL Database          In this section we will create database and table into MySQL database. Table created here will be used in sample application
File path for jar file
File path for jar file  Hi Experts, I have created one eclipse... jar file of that application, unfortunately it is giving the error that resource not found for the template file. Also I had tried to get that path from user
File I/O
File I/O  i have a problem i am trying to print on a new line every... lifecycle management Setup and teardown of services behind a MapView Creating... usually do.Activity responsibilities include: Activity lifecycle management Setup
EAR file
EAR file   What is the EAR file
String file in to word file in java
String file in to word file in java  How to convert a String format notepad file into Ms word file in java
Convesion of txt file to doc file.??????
Convesion of txt file to doc file.??????  how to convert text file to doc file using java
File manipulations
File manipulations  how to count number of words in a file
Tutorials   
Java Spring Hibernate Struts Training What type of programming language is Java? How do beginners learn about Java? ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017

Ads

 
Advertisement null

Ads