Programming with Java

From Juneday education
Jump to: navigation, search

Introduction

Regards from the authors: Rikard Fröberg and Henrik Sandklef

Before reading this book

Intended audience

This book is (at least intended to be) suitable for an introductory programming course. It covers the basics of computing starting with basic computer technology followed by an introduction to imperative programming and moves on to introducing object oriented programming concepts such as objects, classes, interfaces, inheritance etc. The programming language used is Java and the course examples, exercises and assignments are written in a way suitable for programming in the command line. We don't require any prior knowledge in programming or working in the shell, but it is helpful for the reader to have a basic understanding of computers, operating systems and the file system.

This course has been used in various introductory university courses and courses at the Higher Vocational Education level (Swedish: Yrkeshögskola). The authors believe, however, that this book would also work well for courses at high school level, as well as for self-studies by anyone. The chapters in this book have all the lectures available in video format, making the book also useful for distance courses and self-studies.

Requirements

This book assumes you have access to a computer with the following programs/tools installed:

  • a terminal and a shell
  • an editor
  • a Java environment, Java SE Development Kit, at least version 7.

Follow the instruction on the page Setting up your environment.

The focus will be on developing Java applications using the command line and an editor. It is possible to use an IDE for the exercises but the exercise instructions will focus on instructions for creating, compiling and running the exercises from the command line. For a discussion on why we have chosen not to use an IDE for this course, please see Why_not_IDE.

Recommendation - but not a formal requirement

While not a formal requirement, we recommend that the reader gets familiar with working in the shell (e.g. a terminal running bash) and also with the concept of text files and the three streams found in a typical POSIX system - Standard in, Standard out and Standard Error. These chapter from our Bash-introduction book is recommended, but not mandatory, reading:

As with most material found in our books, those chapters have video lectures and exercises.

Chapters

Done and complete

  1. Computer introduction
  2. Computer introduction - Exercises
  3. Programming introduction
  4. Programming introduction - Exercises
  5. Setting up your environment
  6. Programming in Java
  7. Programming in Java - Exercises
  8. Our first Java program
  9. Our first Java program - Exercises
  10. Variables and types
  11. Variables and types - Exercises
  12. Expressions and operators
  13. Expressions and operators - Exercise
  14. Control flow
  15. Control flow - Exercises
    OLD/Obsolete: Objects in Java
  16. Chapter:Objects_-_Introduction
  17. Chapter:Objects_-_Introduction_-_Exercises
  18. Chapter:Objects_-_Relation_to_classes
  19. Chapter:Objects_-_Relation_to_classes_-_Exercises
  20. Chapter:Objects_-_Creating
  21. Chapter:Objects_-_Creating_-_Exercises
  22. Chapter:Objects_-_Using
  23. Chapter:Objects_-_Using_-_Exercises
  24. Chapter:Objects_-_Java_API_documentation
  25. Chapter:Objects_-_Java_API_documentation_-_Exercises
  26. Chapter:Objects_-_Questions_and_Answers
    OLD/OBSOLETE Chapter:Classes_I
    OLD/OBSOLETE Chapter: Classes_II
    OLD/OBSOLETE Chapter: Classes_III
  27. Chapter:Classes_-_Introduction
  28. Chapter:Classes_-_Introduction_-_Exercises
  29. Chapter:Classes_-_Declaration
  30. Chapter:Classes_-_Declaration_-_Exercises
  31. Chapter:Classes_-_Packages
  32. Chapter:Classes_-_Packages_-_Exercises
  33. Chapter:Classes_-_main
  34. Chapter:Classes_-_main_-_Exercises
  35. Chapter:Classes_-_Commenting_code
  36. Chapter:Classes_-_Commenting_code_-_Exercises
  37. Chapter:Classes_-_Declaring_variables
  38. Chapter:Classes_-_Declaring_variables_-_Exercises
  39. Chapter:Classes_-_Defining_constructors
  40. Chapter:Classes_-_Defining_constructors_-_Exercises
  41. Chapter:Classes_-_Defining_methods
  42. Chapter:Classes_-_Defining_methods_-_Exercises
  43. Chapter:Classes_-_Static_members
  44. Chapter:Classes_-_Static_members_-_Exercises
  45. Chapter:Classes_-_final_members
  46. Chapter:Classes_-_final_members_-_Exercises
  47. Chapter:Classes_-_Using_packages
  48. Chapter:Classes_-_Using_packages_-_Exercises
  49. Chapter:Classes_-_Testing_your_classes
  50. Chapter:Classes_-_Testing_your_classes_-_Exercises
  51. Chapter:Classes_-_Using_your_classes
  52. Chapter:Classes_-_Using_your_classes_-_Exercises
  53. Chapter:Classes_-_API_source_code
  54. Chapter:Classes_-_API_source_code_-_Exercises
  55. Chapter:Classes_-_Other_keywords
  56. Chapter:Classes_-_Other_keywords_-_Exercises
  57. Chapter:Classes_-_Strings_are_immutable
  58. Chapter:Classes_-_Strings_are_immutable_-_Exercises
  59. Java_Classes_Wrapping_it_up (extra excercise - writing a class from scratch)
    OLD/Obsolete Inheritance
  60. Chapter:Inheritance_-_What_is_it
  61. Chapter:Inheritance_-_What_is_it_-_Exercises
  62. Chapter:Inheritance_-_Every_class_extends_Object
  63. Chapter:Inheritance_-_Every_class_extends_Object_-_Exercises
  64. Chapter:Inheritance_-_Overriding_methods_in_Object
  65. Chapter:Inheritance_-_Overriding_methods_in_Object_-_Exercises
  66. Chapter:Inheritance_-_Extending_your_own_classes
  67. Chapter:Inheritance_-_Extending_your_own_classes_-_Exercises
  68. Chapter:Inheritance_-_Examples_from_Swing
  69. Chapter:Inheritance_-_Examples_from_Swing_-_Exercises
  70. Chapter:Inheritance_-_Some_rules_and_syntax
  71. Chapter:Inheritance_-_Some_rules_and_syntax_-_Exercises
  72. Chapter:Inheritance_-_Problems_with_inheritance
  73. Chapter:Inheritance_-_Problems_with_inheritance_-_Exercises
    OLD/OBSOLETE Interfaces Number of pages: 24 number of exercises: 23 Number of videos: 4
  74. Chapter:Interfaces_-_Introduction
  75. Chapter:Interfaces_-_Introduction_-_Exercises
  76. Chapter:Interfaces_-_Implementing_an_interface
  77. Chapter:Interfaces_-_Implementing_an_interface_-_Exercises
  78. Chapter:Interfaces_-_Writing_an_interface
  79. Chapter:Interfaces_-_Writing_an_interface_-_Exercises
  80. Chapter:Interfaces_-_Program_against_an_interface
  81. Chapter:Interfaces_-_Program_against_an_interface_-_Exercises
  82. Chapter:Interfaces_-_Creating_an_anonymous_class
  83. Chapter:Interfaces_-_Creating_an_anonymous_class_-_Exercises
  84. Chapter:Interfaces_-_Rules_and_syntax
  85. Chapter:Interfaces_-_Rules_and_syntax_-_Exercises
    OLD/OBSOLETE Exceptions
  86. Chapter:Exceptions_-_What_is_it
  87. Chapter:Exceptions_-_What_is_it_-_Exercises
  88. Chapter:Exceptions_-_Two_main_types
  89. Chapter:Exceptions_-_Two_main_types_-_Exercises
  90. Chapter:Exceptions_-_Code_examples
  91. Chapter:Exceptions_-_Code_examples_-_Exercises
  92. Chapter:Exceptions_-_Creating_your_own
  93. Chapter:Exceptions_-_Creating_your_own_-_Exercises
  94. Chapter:Exceptions_-_Rules_and_syntax
  95. Chapter:Exceptions_-_Rules_and_syntax_-_Exercises
  96. Assignment - Guessing game
  97. Assignment - Address book

Programming in Java in numbers

Disclaimer the following numbers are outdated and have increased since the time of counting

Currently, the book consists of ~48 chapters, which when printed amount to 222 pages (not counting the exercises). Most chapters have have an exercise companion chapter with exercises/questions, in total 387 exercises/questions. In every chapter, we try to include links to further reading, a total of 230 external links so far. Every chapter should have slides and videos with a lecture on the chapter topic. In total we have 211 videos (some videos are parts of the same topic/lecture, and some videos are stand-alone lectures, while other videos are "live" examples of coding).


Moving on - What to read after finishing this book

If you finished reading this book and want to continue with Java (and are not already tired of our way of writing books and exercises), we recommend that you move on to our More programming with Java book.

Perhaps you are using our book for your first Java course and want to prepare for the next Java course. In that case, here are some tips on how to prepare yourself before the next course. We'll link some highlights of what chapters from the More programming with Java book your could continue with, below.

Deeper and broader knowledge of the Java programming language and API

Just for fun

More applied and specialized stuff

Chapter completeness (for teachers)

Chapter Meta section completed Text and examples Videos (number of) Slides Exercises
Computer introduction YES Short text 5 Eng, 5 Swe 5 slides YES
Programming introduction YES Short text 6 Eng, 2 Swe 2 slides YES
Setting up your environment YES Short text 7 Eng No slides (workshop/supervision) No (only workshop/supervision)
Programming in Java YES Short text (and Q&A) 3 Eng, 3 Swe 1 slides YES
Our first Java program YES Yes (also Q&A) 2 Eng, 2 Swe 1 slides YES
Variables and types YES Short text (and Q&A) 7 Eng, 7 Swe 6 slides YES
Expressions and operators YES YES (also Q&A) 2 Eng, 2 Swe 2 slides YES
Control flow YES YES (also Q&A) 5 Eng, 5 Swe 2 Slides YES
Objects_-_Introduction Started/incomplete YES 15 Eng, 15 Swe 1 slides NO
Objects_-_Relation_to_classes YES Medium 1 Eng, 1 Swe 1 slides YES, one small
Objects_-_Creating YES Medium 2 Eng, 2 Swe 1 slides YES
Objects_-_Using YES YES 4 Eng, 4 Swe 4 slides YES
Objects_-_Java_API_documentation YES Medium But see:
Objects Q&A
1 Eng lecture, 5 Eng live, 5 Swe
Live videos
1 slides YES
Objects_-_Questions_and_Answers No, this is a special chapter YES No, special chapter No, special chapter No, special chapter
Classes_-_Introduction YES Short 1 Eng video 1 slides NO
Classes_-_Declaration YES Medium 1 Eng 1 slides! NO
Classes_-_Packages YES YES 1 Eng, 1 Swe 1 slides YES
Classes_-_main YES Medium length intro with example code 2 videos 1 slides YES
Classes_-_Commenting_code YES YES 1 Eng 1 slides YES
Classes_-_Declaring_variables YES YES 2 Eng, 2 Swe 1 slides YES
Classes_-_Defining_constructors YES YES 2 Eng, 2 Swe 1 slides YES
Classes_-_Defining_methods YES Medium 2 Eng, 2 Swe 1 slides YES
Classes_-_Static_members YES YES 2 Eng, 2 Swe 2 slides YES
Classes_-_final_members YES Medium with some examples 1 Eng One slides YES
Classes_-_Using_packages YES YES/Medium 1 Eng, 1 Swe 1 slides YES (a few)
Classes_-_Testing_your_classes YES YES (plus link to
bonus page on Assert)
3 Eng 1 slides YES (a few)
Classes_-_Using_your_classes Yes Short/Medium 2 Eng videos 1 slides
Also, no links
YES (on topic?)
Classes_-_API_source_code YES Hardly No videos! No slides! YES
Classes_-_Other_keywords YES Short 2 Videos 1 slides YES, 2
Classes_-_Strings_are_immutable YES YES (quite long) 1 Eng, 1 Swe 1 slides YES (a few)
Java_Classes_Wrapping_it_up YES YES (quite long) 8 Eng 1 slides YES (this chapter is an exercise)
Inheritance_-_What_is_it YES Short/Medium 1 Eng, 1 Swe 1 slides NO
Inheritance_-_Every_class_extends_Object YES Short 4 Eng, 2 Swe 1 slides YES
Inheritance_-_Overriding_methods_in_Object YES Yes 5 Eng, 1 Swe 1 slides YES
Inheritance_-_Extending_your_own_classes YES Hardly 1 Eng, 1 Swe 1 slides YES
Inheritance_-_Examples_from_Swing YES Short 2 Eng, 2 Swe 1 slides NO
Inheritance_-_Some_rules_and_syntax YES Hardly 2 Eng, 2 Swe 1 slides NO
Inheritance_-_Problems_with_inheritance YES Short/medium 1 Eng, 1 Swe 1 slides Link to extra
Interfaces_-_Introduction YES YES 1 Eng, 1 Swe 1 slides YES
Interfaces_-_Implementing_an_interface TODO YES 3 Eng, 3 Swe 3 slides YES
Interfaces_-_Writing_an_interface TODO YES 1 Eng, 1 Swe 1 slides YES(on topic?)
Interfaces_-_Program_against_an_interface TODO YES 2 Eng videos One slides NO
Interfaces_-_Creating_an_anonymous_class TODO YES 3 videos One slides YES
Interfaces_-_Rules_and_syntax TODO YES 2 videos One slides NO
Exceptions_-_What_is_it YES YES 2 Eng, 2 Swe 1 slides YES (a few)
Exceptions_-_Two_main_types Short YES 2 Eng, 2 Swe 1 slides YES
Exceptions_-_Code_examples Short YES
(quite long)
4 Eng, 4 Swe 1 slides YES
Exceptions_-_Creating_your_own Short YES 2 Eng, 1 Swe 1 slides YES
Exceptions_-_Rules_and_syntax Short YES 1 Eng, 1 Swe 1 slides NO

Information for our students

Information about the exam

  • The exam in a typical course using this book, should be based on the exercises from every chapter. This makes it clear for the students both what to expect and that completing every exercise in every chapter pays off in that it prepares the student for the exam. It also helps the teacher making sure that there is a correspondence between the course and the exam, and that the students have practiced what they should know on the exam.

Book companion - Questions ans Answers

Extra/Bonus chapters/pages - Stuff which didn't really fit into this introductory book