Programming means writing programs. A program is a sequence of instructions, which will be executed by the computer. For a given task, the programmer will have to create a program well suited to accomplish this task. However, it is the computer's microprocessor which will execute the instructions constituting the program. Yet, the microprocessor can only execute very simple instructions. These are too elementary to be efficiently used by a human being. Fortunately, programmers can write their programs in programming language, such as Java, more accessible to a human being. This language will automatically be translated into instructions the microprocessor will understand and execute. More precisely, a program in the Java language is made of one or several text files. In the case of the Java language, a compiler will translate the text file(s) into a bytecode program, which is an intermediate representation of the Java program. This representation is independant from the computer where the program has been compiled. The bytecode program will then be interpreted by a program called a virtual machine. The virtual machine will translate the bytecode into instructions the microprocessor will be able to execute. Since the bytecode program is independant from the computer where it has been created, it can be executed on another computer. In this course, you will learn to analyse a problem and write a program in a high-level language. This language will thus be the Java language. But we will endeavor to remain general and teach you principles valid for most programming languages. For a given problem, you will first have to ponder the sequence of instructions the computer will have to execute. You will then write the Java program corresponding to this sequence of instructions and compile your program to generate a bytecode program. It is possible for the compiling to fail because your program does not respect the rules of the Java language. You will then go back to your program and correct it. Fortunately, the Java compiler will provide error messages, which will guide you along this correction. Once compiled, you will be able to test your program on the virtual machine. At this point, it is possible that your program will not do what you expected because you have erred somewhere in the initial sequence of instructions. You will then go back to the analysis of the program you have done, correct this sequence of instructions and continue the cycle we have just presented. Now, let us create our first Java program. First of all, we need to open a development environment. There are several possible environments. You will find more details on this course's website. For this episode, we will use Eclipse. Our program starts like this : "public class HelloWorld", opening brace Do not attempt to understand these lines right now, just be aware that they are necessary for our program to compile. Then comes : "public static void main, opening parenthese, String, brackets, args, opening brace." This will make more sense in the lectures dedicated to functions. The tradition, when learning a new language is to create a program printing the message "HelloWorld". We will follow this custom. In Java, printing such a message is done as follows. System.out.println("Hello, world"); The braces opened by the first lines must now be closed. You may have noticed that Eclispe has added them automatically, but this is not the case for all development environments. Therefore, do not forget to add them if need be. From now on, be careful to clearly present your programs. Despite not being being mandatory for the program to [compiler not to] perform correctly, it is important for readability. For example, we started these lines on the first column. These two braces are aligned and these lines in the braces are indented to the right. This line between these two braces, also aligned, is indented to the right aswell. Several rules are possible, simply try to be coherent and readable. Now, let us compile our program. On Eclipse, this is done by clicking this button here, launching the compiling and executing the program if the compiling has gone without problem. Since our program is correct, the compiler has been able to create the bytecode program. Eclipe has then automatically executed this bytecode program and you can see that our program has indeed printed the "Helloworld" message. You can also see that the compiling has created a file called "Helloworld.class" which contains the bytecode program created at the compiling. Now, it is quite possible that, while typing your first program, you have made a typo. What happens in such a case, and what should we do? Let us suppose, for example, that you have omitted the semicolon here. if we try to compile this program, you can see that the compiler has printed an error message. This error message informs us that a semicolon is missing and it gives us the line where the semicolon is missing. Now, if we put back the semicolon and recompile the program, we will obtain the "Helloworld" message again, signifying that the compiling and execution have gone without problem. Now, if you have forgotten the quotes, several error messages will be printed. There is no need to panic, one should always start with the first error; often an error is caused by an another error, higher in the program. This is the case here. If we put back the quotes, all the mistakes will vanish. To sum up, be very rigorous while typing your programs. Also, please mind the presentation. In case of errors, always start with the first error and recompile. It will probably correct at least some of the following errors. In order to find your error, start by checking the line number and try to interpret the error message displayed by the compiler, so that you can solve the problem. If you have not done so already, we encourage you to open your development environment and to create your own "helloworld" porgram. In the upcoming episodes, we will see more complex examples, manipulating data.