University College of Applied SciencesProgramming 1
العربية

COMP 2101 · DINF 1103

Learn Java by writing it and running it

Every example in this course is a real Java program you can edit, run and step through line by line, right in your browser, even on a phone.

StartJava Lab

public class Hello {
    public static void main(String[] args) {
        String name = "Sara";
        System.out.println("Hello, " + name + "!");
    }
}

Course plan

  1. 1 Introduction to Programming in JavaFrom a calculator to your first running program
  2. 2 Comments in JavaNotes for people inside the code, ignored by the compiler
  3. 3 Variables and Data TypesHow does a program remember, change and use values?
  4. 4 The printf MethodHow do we print text and numbers exactly the way we want?
  5. 5 Keyboard Input with ScannerToday, for the first time, your program stops and waits for what you type.
  6. 6 Expressions, Casting and MathWhy does 5 / 2 give 2, and how do you make Java calculate exactly what you mean?
  7. 7 Conditions: Programs That ChooseHow does a program decide what to do based on the values it holds?
  8. 8 Many-Way DecisionsWhat does a program do when a question has more than two answers?
  9. 9 While LoopsHow does a program repeat work without us repeating the code?
  10. 10 For LoopsHow do we write counted repetition on one line, and build tables and patterns with it?
  11. 11 Methods: Defining and Calling ThemHow do we give a group of instructions a name and use it whenever we need it?
  12. 12 Method DesignHow do we write small, clear methods that are easy to understand and reuse?
  13. 13 ArraysHow do we store thirty marks without thirty variables?
  14. 14 Array AlgorithmsHow do we add up, search and sort, and how do we store a whole table?
  15. 15 Strings and CharactersHow does a program take apart and understand what a user types?
  16. 16 Final Project and ReviewBring everything you learned into a real program, then test yourself

Lectures 1 to 4 build on the decks by Eng. Badereddin Mohammed Elhalimi and Eng. Mohammed Zuhair Kouhail, extended and corrected. Lectures 5 to 16 are new material awaiting instructor review.