www.duckademy.com Learn Java in an easy and entertaining way
Video 1 Getting started with Java
The goal of this course is to teach you how to program in Java. From the very basics, through lots of exercises, you will get to an advanced level where you can become an expert Java developer.
The course will cover  Getting started with Java  Sorting elements in Java  Control structures  Generics  NetBeans tips and tricks  Variations for storing objects  Basic algorithms  Handling exceptions  Arrays  File handling  Functions and structured programming  Enums  Object-oriented programming in Java  Using external libraries in our programs  Handling dates and times
In this video 1. A quick intoduction to Java 2. Install NetBeans 3. Create our first project (Hello, World!) 4. Variables and types 5. Input/output and calculations 6. Conditions (if) 7. Review exercise
A quick intoduction to Java
 In the TOP 3 (if not the most popular)  3 billion devices run…  Platform independency (write once, run anywhere)  Lots of well paying jobs  Wide usability Java is popular
Java as a tree
Basic computer skills
Basic computer skills Programming in Java Basic Java tools
Basic computer skills Programming in Java Basic Java tools Mobile apps Android Java ME (cards, TV…) Android has the highest, 60% market share among mobile platforms worldwide.
Basic computer skills Programming in Java Basic Java tools Mobile apps Desktop apps Android Games Java ME (cards, TV…) Software tools Scientific research
Basic computer skills Programming in Java Basic Java tools Mobile apps Desktop apps Enterprise (”web”) apps Android Games Java ME (cards, TV…) 90% of Fortune 500 companies use Java. Software tools Banks Scientific research E-commerce applications Backend services
Basic computer skills Programming in Java Basic Java tools Mobile apps Desktop apps Enterprise (”web”) apps Android Games Java ME (cards, TV…) Software tools Programming in Java Banks Scientific research E-commerce applications Backend services Basic Java tools In this course
Travelling to Europe...
Travelling to Europe... Pretty girl!
Pretty girl! Non capisco niente! Travelling to Europe...
Non capisco niente! ??? Travelling to Europe...
Translate (compile) the message... Compiler
Translate (compile) the message... Compiler Pretty girl!... Bella ragazza!
Translate (compile) the message... Pretty girl!... Bella ragazza! Compiler
Interpreter Interpret the message...
Interpret the message... I speak English AND Italian! Interpreter
Interpret the message... Pretty girl! Interpreter
Interpret the message... Lui dice: „Bella ragazza”. Pretty girl! Interpreter
Interpret the message... Lui dice: „Bella ragazza”. Pretty girl! Interpreter
Java style (platform independence)
Java style (platform independence) Compiler
Java style (platform independence) Pretty girl! Compiler
Java style (platform independence) Pretty girl! … Compiler
Java style (platform independence) Pretty girl! … Bela knabino! Compiler
Java style (platform independence) Interpreter Compiler I speak Italian AND Esperanto. I speak Finnish AND Esperanto. Pretty girl! … Bela knabino!
Java style (platform independence) Interpreter Compiler Lui dice: „Bella ragazza” Pretty girl! … Bela knabino!
Java style (platform independence) Interpreter Compiler Pretty girl! … Bela knabino! Lui dice: „Bella ragazza”
Java style (platform independence) Interpreter Compiler Hän sanoo: „Kaunis tyttö” Pretty girl! … Bela knabino! Lui dice: „Bella ragazza”
Java style (platform independence) Interpreter Compiler Hän sanoo: „Kaunis tyttö” Pretty girl! … Bela knabino! Lui dice: „Bella ragazza”
Java style (platform independence) Interpreter Pretty girl! … Bela knabino! Byte code Compiler Hän sanoo: „Kaunis tyttö” Lui dice: „Bella ragazza”
Java style (platform independence) Interpreter Pretty girl! … Bela knabino! Byte code Hän sanoo: „Kaunis tyttö” Lui dice: „Bella ragazza” Compiler Virtual machine Virtual machine
What do we need to start Java programming?
What do we need to start Java programming? JRE
What do we need to start Java programming? JRE IDE
What do we need to start Java programming? JRE IDE JDK
What do we need to start Java programming? JRE IDE JDK JVM
What do we need to start Java programming? JRE IDE JDK JVM NetBeans
What do we need to start Java programming? JRE IDE JDK JVM NetBeans Eclipse
Java Development Kit (JDK) Java Runtime Environment (JRE) Java Virtual Machine (JVM) Integrated Development Environment (IDE) NetBeans Eclipse
Variables and types
Variables and types
Variables and types Shirts T-shirts
Variables and types Underwear Shirts T-shirts
Java variables and types
Java variables and types All types
Java variables and types All typesPrimitive types
Java variables and types All typesPrimitive types Classes
Java variables and types All typesPrimitive types ClassesNumbers
Java variables and types All typesPrimitive types ClassesNumbers Char
Java variables and types All typesPrimitive types ClassesNumbers Char Boolean
Java variables and types All typesPrimitive types ClassesNumbers Char Boolean Integer
Java variables and types All typesPrimitive types ClassesNumbers Char Boolean Integer Real
Java variables and types All typesPrimitive types ClassesNumbers Char Boolean Integer Real Byte
Java variables and types All typesPrimitive types ClassesNumbers Char Boolean Integer Real ByteShort
Java variables and types All typesPrimitive types ClassesNumbers Char Boolean Integer Real ByteShort Long
Java variables and types All typesPrimitive types ClassesNumbers Char Boolean Integer Real ByteShort LongInt
Java variables and types All typesPrimitive types ClassesNumbers Char Boolean Integer Real ByteShort LongInt Float
Java variables and types All typesPrimitive types ClassesNumbers Char Boolean Integer Real Long ByteShort Float DoubleInt
Replace the value of 2 variables!  Don’t write numbers!  Don’t change the existing lines, only include new ones! public class Replace { public static void main(String[] args) { int first = 7; int second = 19; // write something here!!! System.out.println(”first=”+first+” second=”+second); } } Value replacing exercise
Glass exercise
Glass exercise ?
Glass exercise
Glass exercise
Glass exercise
Glass exercise
Glass exercise
Glass exercise
Input/output and calculations
Temperature exercise  Write a program that reads in an integer value denoting a temperature value in Celsius grade.  Calculate and print the Fahrenheit grade!  What do we not know? – How to read in a number – How to make calculations °F = 9 5 °C + 32
Boiling exercise  Write a program that reads in a temperature value (in Celsius) and prints out if the water is boiling at the specified temperature!  What do we not know? – How to run a part of code based on a condition 100 °C
Boiling and freezing exercise  Write a program that reads in a temperature value (in Celsius), and prints out whether the water is boiling or freezing or at normal state at the specified temperature!  What do we not know? – Joining if’s 0 °C 100 °C
Logic operators
Logic operators && || !
True, if both conditions are true. Logic operators && || !
True, if both conditions are true. True, if either condition is true. Logic operators && || !
True, if both conditions are true. True, if either condition is true. Negate: Logic operators && || ! makes true out of false
True, if both conditions are true. True, if either condition is true. Negate: Logic operators && || ! and false makes true out of false out of true.
Conditions (if)
Multiple if-else if-else if-…-else
Multiple if-else if-else if-…-else  Let’s imagine a sausage!  The sausage will represent all the values.
Multiple if-else if-else if-…-else  Let’s imagine a sausage!  The sausage will represent all the values.
Multiple if-else if-else if-…-else  Let’s imagine a sausage!  The sausage will represent all the values.
Multiple if-else if-else if-…-else  Let’s imagine a sausage!  The sausage will represent all the values.
Multiple if-else if-else if-…-else  Let’s imagine a sausage!  The sausage will represent all the values.
Multiple if-else if-else if-…-else  Let’s imagine a sausage!  The sausage will represent all the values.
Review exercise
Fighting exercise  Write a program with which you can simulate one round of fight between you and a monster.  First we read in the attributes of each of you.  Then we play one round of the fight. Peter Tikos
Fighting rules Attributes:  Attack Points (AP)  Defense Points (DP)  Damage (D)  Life Points (LP) Fight (one round):  Attacker is chosen randomly (coin toss)  Attack Points + 2 Dice ? Enemy’s Defense Points > : Attacker hits defender, so life points decreased by damage <= : Miss
Let’s fight!  First let’s generate random numbers!
Let’s fight!  First let’s generate random numbers!  Then we are ready to fight 
What’s next  Choose one from many (switch)  Repeat it! (the loops) – While – Do-while – For  Controlling loops – Break – Continue  Multiple loops one inside the other www.duckademy.com/course/java-programming Check out the course:
End of video 1 Next video: Control structures www.duckademy.com/course/java-programming Check out the course:

Introduction to Java programming - Java tutorial for beginners to teach Java basics in an easy and entertaining way