- •Lecture 1 Programs and algorithms
- •1.1. How a computer operates?
- •1.2. Algorithms and programming languages
- •If (condition) then ... Or if (condition) then ... Else ...
- •1.3. Summary
- •1.4. Exercises
- •Lecture 2 Fundamentals of programming I
- •2.1. The language
- •2.2. Quick start: first program and basics of syntax
- •2.3. Data in a program (variables and literals)
- •2.4. Operations on data (operators and expressions)
- •2.5. Summary
- •2.6. Exercises
- •Lecture 3 Fundamentals of programming II
- •3.1. Making decisions
- •3.2. Iterations
- •3.3. Arrays
- •3.4. Functions
- •3.5. Summary
- •3.6. Exercises
- •Lecture 4 Java and object-oriented methodology
- •4.1. What is Java
- •4.1.1 Java as a universal programming language
- •4.1.2. Java as a cross-platform language
- •4.1.3. Java as a universal environment for gui programming
- •4.1.4. Java as a universal environment for accessing data bases
- •4.1.5. Java as a universal multimedia programming environment
- •4.1.6. Java as a universal means for client-server programming
- •4.1.7. Java in a distributed environment
- •4.1.8. Java as an environment for building applications from ready-to-use components.
- •4.1.9. Java as the environment for xml processing
- •4.1.10. Micro Java
- •4.1.11. Why is Java worth learning?
- •4.2. Introduction to objects
- •4.4. The first program
- •5.2. Literals
- •5.3. Types of variables. Declarations.
- •Type_name variable_name;
- •Identifiers
- •Naming conventions:
- •5.4. More on operators and expressions
- •5.5. Numeric promotions
- •5.6. Summary
- •5.7. Exercises
- •Lecture 6 Objects
- •6.1. Objects and references
- •6.2. The class String
- •6.3. Useful examples
- •6.4. Summary
- •7.2. Defining attributes of objects
- •7.3. Defining operations on objects (methods)
- •7.4 Defining methods of object creation (constructors)
- •7.5. Example
- •7.6. Inheritance
- •7.7. Summary
- •7.8. Exercises
- •Lecture 8 Classes II
- •8.1. Accessing class members. The variable this.
- •8.2. Static members
- •AClassName.AFieldName
- •8.3. Explicit initialization
- •8.4. Packages and imports
- •8.5. Scope of an identifier. Local variables. Access control.
- •8.6. Structure of a program. Running an application.
- •8.7. Summary
- •8.8. Exercises
- •Lecture 9 Decisions
- •9.1. A brief survey of control statements.
- •9.2. Comparison operators and expressions
- •9.3. Logical operators and expressions
- •9.4. Making decisions: the if and if-else statements.
- •9.5. Multivariant selections done with the switch statement.
- •9.6. The conditional operator ?:
- •9.7. Summary
- •9.8. Exercises
3.5. Summary
Having read this lecture, the student should be able to write quite usable programs. The following topics are the most important:
control statements: if and if - else
iteration loops
arrays
functions
The student should practise the above elements writing programs in simplified REXX. This environment makes the first steps in programming easy, as it hides from the programmer many technical details which are not necessary at the beginning. We leave the REXX now and move to a bit more sophisticated Java. The knowledge acquired so far turns out to be very useful in learning Java.
3.6. Exercises
All exercises are to be done using the simplified REXX.
Create a program converting temperatures between Celsius and Fahrenheit degrees. Use control statements and functions.
Create a currency calculator for more than two currencies. Use arrays and functions.
Create a program which stores numbers typed at the command prompt (more than 10) into an array and then displays the elements of the array with 3 elements per line. Program should also display the maximum and the minimum element of the array as well as the average and the sum of all elements.
Lecture 4 Java and object-oriented methodology
Java makes many people think of applets executing in a web browser. For others it is an excellent programming language or a tool for implementing server or database transactions. All these points of view are undoubtedly legitimate but Java is something more than another programming language or a net tool.
One might say that nowadays Java is the richest and the most complete environment of universal and standardized methods for performing any computer science activity.
4.1. What is Java
4.1.1 Java as a universal programming language
Of course, above all Java is a universal programming language.
Syntactic similarity to the C/C++ languages makes it easy to master for a programmer familiar with languages. At the same time Java strives to excel its prototypes. A Java programmer does not have to bother with memory management (the garbage collector does the work for the programmer: it gets rid of unused objects from the memory). Java does not have pointer arithmetic which - allowing access to an arbitrary place in memory - is a frequent cause of errors.
Strict type checking detects many simple errors during compilation, which makes runtime conversions safe.
Proper exception handling enforced by the compiler makes programming in Java safe and reliable. The built-in concurrency mechanisms enable easy synchronization of parallel executing threads (i.e. concurrently executed parts of the same program).
All these ideas - although they might seem a bit weird now - will be explained in detail in the course of the lectures.
Undoubtedly the most important feature of the Java language is its object-orientedness. In general, this means that programs are easier to write and are more reliable than those prepared in non-object languages. Unfortunately Java is not fully object-oriented as some of its syntactic structures (for example the primitive types) are not object-oriented.
The advantages of Java as a programming language may be questionable. But it is not because of purity or excellence that it is worth learning.
Much more important is its universality in all computer applications achieved with cross-platform virtual machine and rich set of standardized libraries integrated with the Java environment.
