Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
error in following code
Tijo Mathew
Greenhorn
Posts: 16
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class SampleDemo { int a=0; try{ int c=b/a; } catch(Exception e) { e.getCause(); } }
this above code in eclipse gives the following error "syntax error on token expected after this token"..please help me soon with answer. thanks a lot in advance.
[Edit: email removed]
dennis deems
Ranch Hand
Posts: 808
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You can't just have a try block hanging out at the top level of your class. It must be in a method.
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 12 years ago
1
Number of slices to send:
Optional 'thank-you' note:
Send
Less specifically, code must be in a method in the class.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Rod Singh
Greenhorn
Posts: 16
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class SampleDemo { public static void main(String[] args) { int a = 0; int b = 10; try { int c = b / a; } catch (Exception e) { System.out.println(e.getMessage()); e.getCause(); } } }
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Error reading from input file?
exeption handling
Combing Multiple String With No StringBuilder?
processLine
Collection specific elements not generic problem
Thread Boost feature
More...