Professor Kit Romano's Web Site

 



Site Index

About Me

Welcome
Definition of Program
Variable Types
Understanding Memory
Declaring Variables
Simple Commands
Concatenation and Strings
Sleep-Threads-Try Catch
Campus Scenes
Pictures
Java simplified
Application Shell Styles
Reading Data From File
Overview of Applets
Excellent Graphics Applet
Online Reference
Nested if statements
Arrays
Sorting Arrays
Using Strings
Functions
Top 20 Replies 
First program 211
Important Class Example
JAVA in SDK Environment
Understanding OOP
OOP simple example
Recursion example
Example of Inheritance
     and use of JTextArea



*** Web Related **********
Build Student Web Page ?
What is FTP
Download WS ftp95
Download Java Plug In
Applets from jbuilder to sdk
Practice Problems

 

Programming Examples

 

 

                                                

 

Simple Commands

Assignment statement

           Variable = Expression;

                            example...        int num = a * b;

Logical if statement         no else

           if ( condition )
                  {
                     true statements
                   }

Logical if statements  simple form

            if ( condition )
                  true statement;;
                      else
                          false statement;;

                             example......        if ( a == b)
                                                                    count =1;
                                                                 else
                                                                     count =2;
 

Logical   if   else  statements  using brackets

            if  ( condition )
                {
                    true statements
                }
                 else
                {
                   false statements
                }

                          example....        if ( a > b)
                                                        {
                                                            count = 1;
                                                            tot=tot+a;
                                                          }
                                                         else
                                                         {
                                                            count = 2;
                                                            tot=tot+b;
                                                          }

do
     {

         statements;

     }    while ( condition );     //  repeat loop while condition is true 

while ( condition )         // while condition is true perform the loop
     {
        statements;
     }                          

for (starting value; test condition ; increment )
    {
        statements;
     }

                       example...            for(a=1;a<100;a=a+1)
                                                        {
                                                                 .......
                                                                 .......
                                                         }