Intro to Java
|
I'm currently in a programming class, and we're starting off with Java. I've had a problem with error trapping, and since I'm still getting acquainted with programming, I was just wondering if there was another way to error trap without using the try...catch statement?
--|| the bitter taste of coffee wakes me up in more than one way ||--
|
Re: Intro to Java
Link |
by
on 2005-03-14 14:46:41
|
another way to trap errors? sure! write code that will never produce errors. some functions, system calls mostly, cannot ever be guaranteed to work at all, so you will NEED to use try-catch. however, some of the time you can use if-statements to weed out error conditions before they actually happen. |
Re: Intro to Java
Link |
by FireballX301
on 2005-04-06 23:40:42
|
The try-catch exception handlers were designed for commercial code, such that when errors inevitably occur (memory access errors, corrupted installation), the system doesn't explode. Try-catch provides the IMO easiest way for a program to gimme out of an error rather than causing a fault. By the way, I'm taking a programming course also, despite prior experience. Java is a *bad* language to begin learning with, simply due to its syntax requirements. I'm watching everyone else in the class struggle, only because Java is lame. I bit my teeth on C++, but I wouldn't recommend it for beginning programmers either. BASIC, Pascal, those are the good ones. Despite me forgetting both completely.
Honor the Brave who Fought.
Honor the Dead who Fell.
Honor the World they Saved.
|
Re: Intro to Java
|
I am also in a programing clas. Can u help me find a way on how to understand and usa threads properly? |
Re: Intro to Java
|
I totally agree with FireballX301, procedural programming languages are great to begin learning the basics with. I also had a hard time with threads, even up to now, I can't fully grasp the concept. :( A guess just familiarize yourself with the the Thread class and it's exceptions by practice and experience. :)
When crossing a long and high bridge, don't look down to see how deep you can fall but look straight ahead to see what's awaiting for you...
|
Re: Intro to Java
|
I'm also in a computer class, we're using Java. So what exactly are you trying to do with a thread. I might be able to help.
From the day I was born till the day I die the only side I'm on is my own.(Saiyuki)
|
Re: Intro to Java
|
I'M in java class right now too! and WOW! i finished my AP exam last week.. i'm glad that i'm no longer needed to stress all over my code.... java is a great language... but i would rather prefer something else over programming... |