Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Java Introduction BW

Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Introduction

18 February 2019
Contents

• Brief history
• Features of Java
• Four Pillars of OO
• Java Program Constructs
Brief History of Java

Java SE
Duke
Java EE
Java ME
Java Cloud
Java Embedded
https://www.oracle.com/java/technologies/index.html
_____________

https://www.kettlemag.co.uk/the-history-of-the-java-programming-language/
https://twitter.com/jalalkiswani
Features of Java
https://www.youtube.com/watch?v=O5hShUO6wxs

1. Object-oriented
2. Simple
3. Secured
4. Platform-independent
5. Robust
6. Portable
7. Architectural Neutral
8. Dynamic
9. Interpreted
10. High Performance
11. Multithreaded
12. Distributed
https://www.javatpoint.com/features-of-java
The Four Pillars of OOP

https://www.vivaxsolutions.com/images/four-pillars.png
Abstraction Tangible IntangibleConceptual
CLASS OBJECT
Class Fish Nemo Identity
name
Color Orange and white
Instance Length 21.5
Name Name State
variables
Position Position

Swim() Swim()
Talk() Talk()
Methods MoveEyes() MoveEyes() Behavior
MoveLips() MoveLips()
Abstraction

https://www.guru99.com/java-oops-class-objects.html
Inheritance

A class cannot inherit from


multiple super classes, but
can implement multiple
interfaces.
Java also support hybrid
inheritance. https://www.tutorialspoint.com/java/java_inheritance.htm
http://www.pateanu.ca/yorku/ITEC2610/ch09/index.html

https://study.com/academy/lesson/inheritance-vs-polymorphism-in-java.html

https://www.jitendrazaa.com/blog/java/difference-between- https://codedbug.com/inheritance-in-java/
interfaceinheritance-abstract-class/
Polymorphism

http://editimage.club/newakc290930.html
Overriding

Same method name.


Same parameter,
different implementation

https://tutorial.eyehunts.com/java/java-polymorphism-
definition-type-example/
Overloading

https://javahungry.blogspot.com/2018/11/method-
overloading-in-java-with-examples.html

https://www.programcreek.com/2009/02/overriding-
and-overloading-in-java-with-examples/

https://programmingstack.com/java-
methods/9-java/49-java-method-
overloading.html
Encapsulation

https://www.geeksforgeeks.org/access-modifiers-java/
Java Program Constructs

class header method header or signature


body of method
body of class

comment
statement
semicolon
Java Escape Sequences
System.out.print("These are our top sellers:\n");
System.out.print("\tComputer games\n\tCoffee\n ");
System.out.println("\tAspirin");

These are our top seller:


Computer games
Coffee
Asprin
Which one?
https://howtodoinjava.com/java/basics/jdk-jre-jvm/
JDK
JRE

JVM

https://www.quora.com/What-is-the-difference-between-JVM-and-JDK

http://www.ntu.edu.sg/home/ehchua/programming/java/j1a_Introduction.html
Summary
• Java is a case-sensitive language.
• All Java programs must be stored in a file with a
.java file extension.
• Comments are ignored by the compiler.
• A .java file may contain many classes but may only
have one public class.
• If a .java file has a public class, the class must have
the same name as the file.
• Java applications must have a main method.
• For every left brace, or opening brace, there must be a
corresponding right brace, or closing brace.
• Statements are terminated with semicolons.
• Comments, class headers, method headers, and braces are
not considered Java statements.
Vocabulary
Review Questions

1. Why do we create computer programs?


2. Illustrate what happen to a java source code file
from the beginning until its execution.
3. What is the difference between a statement
and a comment?
4. Why must programs written in a high-level
language be translated into machine language
before they can be run?
5. What is pseudocode?
6. Java is portable. Explain.
7. What does compile means?
8. Compare C++ and Java program
development.
9. JVM stands for ___
10.Why does byte code make Java a
portable language?
Resources
• BlueJ http://bluej.org/
• Think Java (Allen Downey & Chris Mayfield)
• http://greenteapress.com/thinkjava6/thinkjava.pdf

• Online Java Compiler


• https://www.tutorialspoint.com/compile_java_o
nline.php
• https://www.jdoodle.com/online-java-compiler
• https://www.compilejava.net
• Online Java Tutorial
• https://docs.oracle.com/javase/tutorial/java/
• https://www.w3schools.in/java-tutorial/
• https://www.tutorialspoint.com/java/

You might also like