Intro to Java and BlueJ

What is Java?

Java is a proprietary language, originally created by Sun Microsystems, now owned by Oracle. It is an object oriented, event driven, statically typed, highly portable language. You may not know what any of that means at this point but you will know by the end of the course!

Why Learn Java?

Python is a great beginners language, and is very quick to develop programs with. It is unfussy about types. However you miss out on some important concepts if you only develop in Python and don’t know any other languages. I would argue Java allows for better progression to other languages, and if you go on to study at university you will may well have to learn Java, though this is slowly changing as Python becomes more popular.

If you learn Java, it is an easy step to C#, and less of a leap to C/C++.

Javascript is not the same thing as Java – though the basic syntax is very similar. Once you have become familiar with the Java syntax, Javascript will be easier to understand if you have only ever previously learned Python.

I think it is important that students learn more than one language because it reinforces the core concepts involved in programming. Building on those core concepts and elaborating on them is called the spiral theory of learning.

Java is still one of the most in demand skills out there (according to http://www.codingdojo.com/blog/9-most-in-demand-programming-languages-of-2016/)

Some of this course will involve some repetition of what you have already done in Python or other languages you may have learned – and that’s fine!

Installing

You will need to download and install BlueJ – I recommend you also install the Java 8.0 SDK, as later in the course we will create programs with a graphical user interface using JavaFX.

Creating an object in BlueJ

  1. Extract the file here to a folder on your own computer.
  2. Double click on the package.bluej file and it should open in BlueJ.
  3. Click on the compile button to compile the code in Book.java.
  4. Use the book class to create an object on the BlueJ workbench by right clicking on the Book class, and selecting New.
  5. Fill in the details for a book of your choice. Note that all of these items are strings so you should enter them inside quotes, e.g. “Harry Potter”
  6. When you have succesfully created an object, it will appear as a red rectangle on the object workbench at the bottom left of the screen. Double click on it to inspect its contents or right click and select “displayDetails()” to run some code.