In the previous lesson you learnt about using classes and methods. Previous lesson: 3.1 Using classes and methodsCourse contents Method overloading The Animal class currently defines a constructor which requires three argument values to be supplied (for the name, gender and age), and if when you invoke this constructor you supply the wrong number o...
In the previous lesson you saw how to use the Java APIs. Previous lesson: 2.4 The Java APIsCourse contents Using classes and methods Methods provide the means of telling an object what it can do. In this series of lessons you will learn: Methods which change an object's stateOverloading and inheritanceAbstract classes and methods Methods that ...
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.6 of the Java programming course. Previous lesson: 1.5 Java syntax and naming conventionsCourse contents How Java programs are entered While it is possible to use a simple text editor to enter Java source code, and to use command line instructions to invoke the compiler, it is generally beneficial to use an Integrated Developm...
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...