Tutorials : Java by Example : Section 1 :
Section One Contents
Basic Graphics Functions
Simple Methods And Basic Data Types
If, Else And Switch: Basic Control Structures

Java Basics

If, Else And Switch: Basic Control Structures - Con't

In many cases you will also want to check for other cases, if case 1 is not true. You could write:
if(test-expression1)
   body1
if(test-expression2)
   body2
if(test-expression3)
   body3
but these statements would be tested independently from each other. Suppose case 3 is correct, but case 2 also. Or case 1 and case 2 are true, but you want to execute body3 only if test-expression1 and test-expression2 are false. You could use the following statement:
if(test-expression1)
   body1
if(test-expression2)
   body2
if(test-expression1==false && test-expression2==false)
   body3
Doing that, it might occur that both body1 and body2 are being executed, if test-expression1 AND test-expression2 are true. If you want only one of the three bodys to be executed, you must use the following:
if(test-expression1)
   body1
else if(test-expression2)
   body2
else
   body3

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.