/learn-some-java

Tutorial for getting started with Java - see instructions below

Primary LanguageJavaMIT LicenseMIT

Getting Started

Getting yourself ready

  1. Complete the quiz to assess your current level - Click the "Check Now" button here - https://app.pluralsight.com/paths/skills/java
  2. It would be good to post your score to the Blackboard discussion forum.
  3. Unless Pluralsight is telling you that you are Proficient in Java then you should start on the "Absolute Beginner" section below.

Absolute Beginner

If you don't feel at all confident in Java you may want to start from the very beginning. Here is how we recommend you start.

  1. 🎦 VIDEO watch Course Overview and Introduction and Setting up... in Pluralsight. See my notes on the videos
  2. 👷 TASK (If you haven't already) install Java and an IDE like instructed in the video.
  3. 👷 TASK As a break from this follow the instructions in this video to set up your machine for running the real exercises - https://youtu.be/P1nz1CMs90g

If you have had any problems getting your Java environment or Gradle/Exercises set up - let us know in the Blackboard forums.

  1. 🏃 EXERCISE Get the "return" exercise running as shown in the video above.
  2. 🎦 VIDEO watch Variables, Data Types and Math Operators and Conditional Logic, Looping and Arrays
  3. 🏃 EXERCISE Complete the types-and-maths exercise that you downloaded when following the instructions in Task 3 above.
  4. 🎦 VIDEO watch watch Conditional Logic, Looping and Arrays
  5. 🏃 EXERCISE Complete exercises 4 to 9 ('if' to 'calculator')

If you have any problems during these, let us know on the Blackboard forum.

[Optional] if you want to test your knowledge you could install the SoloLearn app or us it only. If you've one the above you should be able to complete the "Basic Concepts" section here - http://www.sololearn.com/Play/Java/#

Moving onto OO

  1. 🎦 VIDEO watch Representing complex types with Objects
  2. 🏃 EXERCISE Complete exercise 10 and 11 (objects and object-array)
  3. 🎦 VIDEO watch Class initialisers and contructors
  4. 🏃 EXERCISE go back to exercise 11 and remove the setNumber() method and instead use a constructor - check that the tests still pass.
  5. We will skip the "A Closer look at parameters" and "Class Inheritance" for now. These are useful when getting really OO, but there are more important practical things to learn first.
  6. 🎦 VIDEO watch More about data types
  7. 🎦 VIDEO We'll skip most of the videos and jump to Static Members in the Static Members, Nested Types, etc module. This is because some of the upcoming exercises use static members so you need to know this.

Exercism Exercises Part 1

We are now going to start using exercism.io for the exercises. Congratulations for getting to the stage where you can do this. All of the skills required for these exercises should have been contained in the videos. If you have any problems just ask.

Registering for Exercism

To log into exercism.io you will need a github account. If you don't already have one then register here - https://github.com/join. So that others can help you with the exercises you will be added to our Java bootcamp team within exercism. Post your github username into the discussion forum post for this.

Completing the exercises

  1. Go here and follow the instructions to install the CLI for Exercism http://exercism.io/how-it-works/newbie.
  2. Start working through the exercises in the order below. We'll keep an eye out for your submissions to see where you need help. After submitting take a look at others' submission to see how others do it.
  • Hello World
  • Bob
  • Space Age
  • Raindrops
  • Hamming
  • Simple Linked Lists
  • Rna Transcription
  • Pig Latin
  • Binary
  • Linked Lists

Additional Exercises - Koans

Now we've covered the basics of Java programming and some important stuff to do with Objects. The next big (and important) topic is Java collections.

Before you move onto that: there are still a lot of gaps regarding the Java language, that aren't covered in the videos or the exercises. These are things that you will just have to pick up as you go. However, one way to expose you to there is to work through the excellent exercises below. They cover a lot of what you've already seen, but also little things you've not. Go through them one by one and when you come across something unfamiliar, either ask, Google or check out Pluralsight.

Before you do the exercises, you will need to learn a little about the different ways in which we can check whether objects are the same.

🎦 VIDEO watch Equality in Class Inheritance in Java Fundamentals

Java Koans

Full Exercise List

  1. debugging - run the tests to see the errors then fix them.
  2. return - make the function return a value. [return]
  3. types-and-maths - some simple maths [variables and maths]
  4. if - nested if statements [if]
  5. conditions-river-crossing - return what happens when you leave a fox, chicken and bag of corn on a river bank [conditional logic]
  6. array-length - return the length of an integer array [arrays]
  7. factorial - multiple all numbers from 1 to n [for loop, arithmetic]
  8. add-array - add all the numbers in an integer array [for loop, arithmetic]
  9. calculator - return the result of applying an arithmetic operator to 2 values [switch, arithmetic]
  10. objects - Create an object with the right method [objects]
  11. object-array - create an array of objects based on an int array [objects, for loops, arrays]
  12. objects-access-modifiers - fix the access modifiers to allow access outside of the package [objects, packages]