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

 

 

                                                

 

Declaring Variables

Decide on what values are going to be processed by your program. Pay careful

attention as to what type of value it is. Values can be thought of as data or items

to be processed. Values can be input or actually declared in the program in the

form of what is called a literal value ( what you see is what it is ) Make note that a

variable's value can change so variables can be used over and over with different

values each time.  If it were not for this concept no one would ever write programs

because it would not be worth the effort. Before I show examples remember to

use variable names that make your program easy to understand. Variable names 

must begin with a letter, cannot contain a blank in the name, and may not use

special symbols in forming the name. Use an underscore character to improve

readability. In the examples below I will also show how variables are assigned

values. Also notice that all command in JAVA end with a semicolon. The "=" sign

is regarded as the assignment symbol. The next section will explain in more detail

the use of this symbol.

EXAMPLES

int male_counter;                                           char race_code;

int frmale_counter ;                                        String student_name;

float gpa;                                                        Boolean is_person_tall;

int num_students = 0;                                      float average_score = 0;