introduction to java programming - java tutorial for beginners to teach java basics in an easy and...
TRANSCRIPT
www.duckademy.com
Learn Java in an easy and entertaining way
Video 1
Getting startedwith 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 (writeonce, 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 appsAndroid
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
Desktopapps
Android
Games
Java ME (cards, TV…)
Software tools
Scientific research
Basic computer skills
Programming in Java
Basic Java tools
Mobile apps
Desktopapps
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
Desktopapps
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)
Prettygirl!
Compiler
Java style (platform independence)
Prettygirl!…
Compiler
Java style (platform independence)
Prettygirl!…Bela
knabino!
Compiler
Java style (platform independence)
Interpreter
Compiler
I speak ItalianAND Esperanto.
I speak FinnishAND Esperanto.
Prettygirl!…Bela
knabino!
Java style (platform independence)
Interpreter
Compiler
Lui dice: „Bella ragazza”
Prettygirl!…Bela
knabino!
Java style (platform independence)
Interpreter
Compiler
Prettygirl!…Bela
knabino!
Lui dice: „Bella ragazza”
Java style (platform independence)
Interpreter
Compiler
Hän sanoo: „Kaunis tyttö”
Prettygirl!…Bela
knabino!
Lui dice: „Bella ragazza”
Java style (platform independence)
Interpreter
Compiler
Hän sanoo: „Kaunis tyttö”
Prettygirl!…Bela
knabino!
Lui dice: „Bella ragazza”
Java style (platform independence)
Interpreter
Prettygirl!…Bela
knabino!Byte code
Compiler
Hän sanoo: „Kaunis tyttö”
Lui dice: „Bella ragazza”
Java style (platform independence)
Interpreter
Prettygirl!…Bela
knabino!Byte code
Hän sanoo: „Kaunis tyttö”
Lui dice: „Bella ragazza”
Compiler
Virtualmachine
Virtualmachine
What do we need to startJava programming?
What do we need to startJava programming?
JRE
What do we need to startJava programming?
JRE
IDE
What do we need to startJava programming?
JRE
IDE
JDK
What do we need to startJava programming?
JRE
IDE
JDK
JVM
What do we need to startJava programming?
JRE
IDE
JDK
JVM
NetBeans
What do we need to startJava programming?
JRE
IDE
JDK
JVM
NetBeans
Eclipse
Java Development Kit(JDK)
Java Runtime Environment(JRE)
Java VirtualMachine
(JVM)
Integrated DevelopmentEnvironment
(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 RealByte
Java variables and types
All typesPrimitive types ClassesNumbers
Char
Boolean
Integer RealByteShort
Java variables and types
All typesPrimitive types ClassesNumbers
Char
Boolean
Integer RealByteShort
Long
Java variables and types
All typesPrimitive types ClassesNumbers
Char
Boolean
Integer RealByteShort
LongInt
Java variables and types
All typesPrimitive types ClassesNumbers
Char
Boolean
Integer RealByteShort
LongInt
Float
Java variables and types
All typesPrimitive types ClassesNumbers
Char
Boolean
Integer RealLong
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=95 ° 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 rulesAttributes:
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
Rules
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-programmingCheck out the course:
End of video 1
Next video:
Control structures
www.duckademy.com/course/java-programmingCheck out the course: