the differences between keyword thow and thows in java

J

Joshua Cranmer

hunglduc said:
can u please answer for me

There are no such keywords as 'thow' or 'thows'.

You might be referring to 'throw' or 'throws'. Incidentally, have you
checked with your textbook/classmates/teacher/professor yet? This sounds
like stuff you should be covering in class...
 
O

Owen Jacobson

the differences between keyword thow and thows in java

can u please answer for me

Neither "thow" nor "thows" are keywords in Java. Spelling matters.

"throw" is a statement fragment. A "throw" statement causes an
exception to be thrown when it's evaluated.

"throws" is a declaration fragment. A method may be declared to
"throws" a list of exceptions, which the calling method must be
prepared to handle.

For more details, see
- http://java.sun.com/docs/books/tutorial/essential/exceptions/
- http://java.sun.com/docs/books/jls/third_edition/html/exceptions.html

-o
 
L

Lew

The word is "you", not "u". Spelling counts in Java, as with all
computer languages, so it is good to practice good spelling in the
Java forums, too. For example, if you try to use "thow" or "thows" in
your code to mean 'throw' or 'throws', respectively, it will not
compile.

Also, it is conventional to state your question in the body of your
post, not just the subject line. It makes it marginally easier for
others to follow the conversation in these discussions.

Your question about the difference between 'throw' and 'throws' is
completely answered in the Java Language Specification (JLS):

<http://java.sun.com/docs/books/jls/third_edition/html/
exceptions.html>
That section details the semantics of the 'throw' command.

The 'throws' keyword is explained in detail in
<http://java.sun.com/docs/books/jls/third_edition/html/
classes.html#8.4.6>
for methods and
<http://java.sun.com/docs/books/jls/third_edition/html/
classes.html#8.8.5>
for constructors.

The tutorial for exceptions is at
<http://java.sun.com/docs/books/tutorial/essential/exceptions/
index.html>

You will find java.sun.com an excellent first source of information
for Java programming. The JLS and the tutorials are where you should
start for language understanding; the API Javadocs
<http://java.sun.com/javase/6/docs/api/>
for information about the standard APIs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top