Introduction to Programming Using Java
- Variables are the main objects that contain information sent to users and retrieved from users. The variable type must be defined when you start the program. Variable types include strings, integers, decimal numbers, class variables and arrays. The programmer must define the variable type before the variable is assigned a value, but Java includes type conversion functions to switch the variable definition. For instance, you can switch from the integer variable type to a string.
- Classes are compartmental sections of your application. Classes let you create objects that are logical parts of the program. For instance, if you design a website for accounting, logical components include users, revenue forms, accounts payable forms, payment processors and customers. Classes contain functions and properties for each component of your application. Classes are also the fundamental objects of object-oriented programming. Instead of linear execution in an application, you can call each class from anywhere in the code to switch focus.
- Functions are blocks of code that calculate input from the application and return a value. Functions are included in Java programming, so you do not need to type out the same process on several Java forms. For instance, if you calculate revenue several times in an application, you create the code in a function, so you just need to call the function each time instead of typing the calculation code several times.
- Functions are considered the "verbs" of a Java application, because they perform an action. Properties are the "nouns" of an application. Properties define aspects of the form. For instance, text color is a property of a form. Font style, background color, titles and window location are all properties of a form. Properties are also used in classes, so you can set class aspects when using the class in a form.