In the previous lesson we covered packages and imports. Previous lesson: 4.1 PackagesCourse contents The Object class You saw earlier that any class can extend (i.e., inherit from) any other class, and this can be another class written by you or someone else, or a Java supplied class. In fact, every class always inherits from a special Java s...
In the previous lesson we tidied up the Animal constructors. Previous lesson 3.6: Tidying up the Animal constructorsCourse contents Packages, the Object class, and interfaces Packages allow you to partition your classes into sets of logical groups, and enables you to protect parts of your application from other parts. The Object class provides the ...
In the previous lesson we looked at abstract classes and methods. Previous lesson 3.5 Abstract classes and methodsCourse contents Tidying up the Animal constructors Since making the Animal class abstract the only constructor that ever gets invoked within Animal is the one requiring three arguments, which is called by its subclasses using the ...
In the previous lesson you learnt about overriding. Previous lesson: 3.4 OverridingCourse contents Abstract classes and methods Now that you have created three subclasses of Animal you might like to consider what is meant by "animal": does it ever make sense to instantiate an Animal object that isn't a specific type of animal? It seems natural to t...
In the previous lesson you learnt about inheritance. Lesson 3.3 InheritanceCourse contents Overriding The zoo would like to know which animal types are endangered, even though most types in the zoo are not. Add the following method within the Animal class: public boolean isEndangered() { return false;} Note that for getter methods that...
In the previous lesson you learnt about overloading. Lesson 3.2 OverloadingCourse contents Inheritance It was mentioned earlier that there is currently no obvious way of specifying what type of animal is being created. You might guess that Bruno could be a dog or that Tiddles could be a cat, but there is no guarantee of this. For the zoo appl...
In the previous lesson you saw how to deal with errors. Previous lesson 2.3 Dealing with errorsCourse contents The Java APIs Java contains many pre-built classes to facilitate programming for graphics, networking, multi-threading[1], etc. You can access the Application Programming Interface (API) documentation for all of Java supplied classes from ...
In the previous lesson you learnt how to create objects. Previous lesson: 2.2 Creating objectsCourse contents Dealing with errors Errors in Java programs can be categorised into two types: Errors that stop the class from being compiled.Errors where the program compiles successfully but does the wrong thing when it runs. There are two categories of ...
This is lesson 2.2 of the Java programming course. Previous lesson: 2.1 Object-oriented conceptsCourse contents Creating objects Object instances are created using the new keyword, which is followed by the constructor name[1] and arguments (if applicable). Here is an example where a Date object is created[2]: [1] Remember that constructor...
This is Section 2 of the Java programming course. Previous lesson: 1.8 Example Java class to model an animalCourse contents Object-oriented programming Java is an object-oriented programming language, providing you with a means of modelling your programs in a way that more closely models the real-world as compared to procedural languages. In this s...
This is Lesson 1.8 of the Java programming course. Previous lesson: 1.7 Creating a simple Java programCourse contents Example Java class to model an animal Earlier a class called Animal was specified capable of storing an animal's name, gender and age, and also capable of providing that information upon request. You will therefore start to wri...
This is Lesson 1.7 of the Java programming course. Previous lesson: 1.6 How Java programs are enteredCourse contents Creating a simple Java program In this course you will learn the major facilities of the Java language through the gradual development of a "virtual zoo". This will entail developing classes that model different types of a...
This is Lesson 1.5 of the Java programming course. Previous lesson: 1.4 How programs are developedCourse contents Java syntax and naming conventions In common with most languages, Java programs must adhere to a certain syntax in order for them to be successfully compiled. There are also certain conventions which ought to be complied with to ai...
This is Lesson 1.4 of the Java programming course. Previous lesson: 1.3 What is object oriented programming?Course contents How Java programs are developed Most programming languages use a specific set of commands that resemble English, but which must follow a prescriptive set of rules. By using commands that loosely resemble English it ...
This is Lesson 1.3 of the Java programming course. Previous lesson: 1.2 History and usages of JavaCourse contents What is object-oriented programming? Object-oriented programming is an attempt to model the real world more closely when developing software, compared to procedural languages. The two key terms you need to understand at this stage ...
This is Lesson 1.2 of the Java programming course. Previous lesson: 1.1 introductionCourse contents The history and usages of Java Java dates back to the early 1990s as a research project undertaken at Sun Microsystems (now part of Oracle) to look at the application of computers to consumer electronic devices. The research team originally cons...
Introduction Audience & purpose This course is intended for the new or inexperienced programmer who wishes to become familiar with the Java programming language, in particular to learn good design and implementation principles. You will be taken step-by-step through the creation and implementation of a desktop application that models a vi...
This series of articles is an adaptation of the author's book Java programming step-by-step, and aims to take you teach you the fundamentals of the Java language in manageable increments. Section 1: Introduction 1.1 Introduction to the course 1.2 Brief history and usages of Java 1.3 What is object-oriented programming? 1.4 How programs are develope...
Suitable both for beginners and those with some programming experience, this book will guide you step-by-step through the development of a desktop application written using the Java programming language. No prior knowledge is assumed, and each step is clearly explained so you can follow along in your own time.In this book you will learn:How to appl...
Java Design Pattern Essentials - Second Edition (available as a paperback book or as a downloadable eBook) will help take your knowledge of the fundamentals of the Java programming language and put it into practice in the real world by learning about Design Patterns. Now you too can use the techniques developed by experts over the last couple of de...