SlideShare a Scribd company logo
1 of 32
Download to read offline
IT 405: KPLBO
Review Java Dasar
Ayi Purbasari, ST., MT.
Unpas, 2014
Outline
Primitive Java types,
operators on those types,
and expressions formed with
those types
The anatomy of a simple Java
program
The mechanics of compiling
and running such programs
Javaā€™s block-structured
nature
Various types of Java
expressions
Loops and other flow control
structures
Printing messages to the
command window from
which a program was
launched, which is especially
useful for testing code as it
evolves
Elements of Java
programming style
MENGENAL JAVA
Java
ā€¢ Java is a computer programming language that
is concurrent, class-based,object-oriented, and
specifically designed to have as few implementation
dependencies as possible.
ā€¢ It is intended to let application developers "write once,
run anywhere" (WORA), meaning that code that runs
on one platform does not need to be recompiled to run
on another.
ā€¢ Java applications are
typicallycompiled to bytecode (class file) that can run
on any Java virtual machine (JVM) regardless
of computer architecture.
Java
ā€¢ Java is, as of 2014, one of the most popular
programming languages in use, particularly for client-
server web applications, with a reported 9 million
developers.
ā€¢ Java was originally developed by James Gosling at Sun
Microsystems (which has since merged into Oracle
Corporation) and released in 1995 as a core
component of Sun Microsystems' Java platform.
ā€¢ The language derives much of its syntax from C
and C++, but it has fewer low-level facilities than either
of them.
TIOBE Index for February 2014
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Sejarah Java
Duke
James Gosling
ā€¢ born May 19, 1955
ā€¢ Carnegie Mellon
University
University of Calgary
ā€¢ Canadian
History
ā€¢ Sun Microsystems released the first public implementation as Java 1.0 in
1995.[1]
ā€¢ It promised "Write Once, Run Anywhere" (WORA), providing no-cost run-
times on popularplatforms.
ā€¢ Fairly secure and featuring configurable security, it allowed network- and
file-access restrictions.
ā€¢ Major web browsers soon incorporated the ability to run Java
appletswithin web pages, and Java quickly became popular.
ā€¢ With the advent of Java 2 (released initially as J2SE 1.2 in December 1998
ā€“ 1999), new versions had multiple configurations built for different types
of platforms.
ā€¢ For example, J2EE targeted enterprise applications and the greatly
stripped-down version J2ME for mobile applications (Mobile Java).
ā€¢ J2SEdesignated the Standard Edition. In 2006, for marketing purposes, Sun
renamed new J2versions as Java EE, Java ME, and Java SE, respectively.
Principles
ā€¢ There were five primary goals in the creation of
the Java language:[
ā€¢ It should be "simple, object-oriented and
familiar"
ā€¢ It should be "robust and secure"
ā€¢ It should be "architecture-neutral and portable"
ā€¢ It should execute with "high performance"
ā€¢ It should be "interpreted, threaded, and
dynamic"
Version
JDK 1.0
(January
21,
1996)
JDK 1.1
(February
19, 1997)
J2SE 1.2
(December
8, 1998)
J2SE 1.3
(May 8,
2000)
J2SE 1.4
(February
6, 2002)
Version .. (lanjutan)
J2SE 5.0
(September
30, 2004)
Java SE 6
(December
11, 2006)
Java SE 7 (July
28, 2011)
Java SE 8
(March 18,
2014)
Java (software platform)
Original author(s) James Gosling, Sun Microsystems
Developer(s) Oracle Corporation
Stable release 7 Update 51 (1.7.0_51)(January 14, 2014; 33
days ago)
Preview release 8 Build 129 (February 11, 2014; 5 days ago) [Ā±]
Written in Java, C++
Operating system Windows, Solaris, Linux,OS X
Platform IA-32, x86-64, SPARC,ARM
Type Software platform
License Freeware, mostly open-source, with a
fewproprietary
[7]
components
Website www.java.com
Edisi Java
ā€¢ Java Card
ā€¢ Micro Edition (ME)
ā€¢ Standard Edition (SE)
ā€¢ Enterprise Edition (EE)
ā€¢ JavaFX
ā€¢ PersonalJava (discontinued)
Standard Edition (SE)
ā€¢ General purpose
packages
ā€“ java.lang
ā€“ java.io
ā€“ java.nio
ā€“ java.math
ā€“ java.net
ā€“ java.text
ā€“ java.util
ā€¢ Special purpose packages
ā€“ java.applet
ā€“ java.beans
ā€“ java.awt
ā€“ java.rmi
ā€“ java.security
ā€“ java.sql
ā€“ javax.rmi
ā€“ javax.swing
ā€“ javax.swing.text.html.parse
r
ā€“ javax.xml.bind.annotation
Java platform
ā€¢ One characteristic of Java is portability, which means that
computer programs written in the Java language must run
similarly on any hardware/operating-system platform.
ā€¢ This is achieved by compiling the Java language code to an
intermediate representation called Java bytecode, instead
of directly to platform-specific machine code.
ā€¢ Java bytecode instructions are analogous to machine code,
but they are intended to be interpreted by a virtual
machine (VM) written specifically for the host hardware.
ā€¢ End-users commonly use a Java Runtime Environment (JRE)
installed on their own machine for standalone Java
applications, or in a Web browser for Java applets.
Java Virtual Machine
ā€¢ The JVM is a special piece of software that
knows how to interpret and execute Java
bytecode
Java Virtual Machine
Java Bytecode
Java
Virtual
Machi
ne
Hello World !
ā€¢ Praktek membuat hello world, diperlihatkan
struktur file, dan java bytecode.
Struktur Program Java
REVIEW
Loops and Other Flow-Control Structures
If Statement
if (logical-expression-1) {
execute this code
}
else {
if (logical-expression-2) {
execute this alternate code
}
else {
execute this code if neither of the
above expressions evaluate to
true
}
}
if (logical-expression-1) {
execute this code
}
else if (logical-expression-2) {
execute this alternate code
}
else {
execute this code if neither of the
above expressions evaluate to
true
}
Switch Statement
switch (int-or-char-expression) {
case value1:
one or more lines of code to execute if value of expression matches
value1
break;
case value2:
one or more lines of code to execute if value of expression matches
value2
break;
// more case labels, as needed ...
case valueN:
one or more lines of code to execute if value of expression matches
valueN
break;
default:
default code to execute if none of the cases match
}
For Statement
for (initializer; condition; iterator) {
code to execute while condition evaluates to
true
}
public class ForDemo {
public static void main(String[] args) {
// Compute a simple multiplication table.
for (int j = 1; j <= 4; j++) {
for (int k = 1; k <= 4; k++) {
System.out.println(j + " * " + k + " = " + (j * k));
}
}
}
}
while Statements
while (condition) {
code to repeatedly execute while condition
continues to evaluate to true
}
public class WhileDemo {
public static void main(String[] args) {
boolean finished = false;
int i = 0;
while (!finished) { System.out.println(i); i++;
if (i == 4) finished = true; // toggle the flag to
terminate the loop
}
}
}
Block-Structured Languages and the
Scope of a Variable
public class ScopeExample { // Start of block level 1.
public static void main(String[] args) { // Start of block level 2. double x = 2.0; //
Declare "x" at block level 2.
if (x < 5.0) { // Start of block level 3.
double y = 1.0; // Declare "y" inside block level 3.
System.out.println("The value of x = " + x); // x, declared at level 2, is
// still in scope at level 3.
System.out.println("The value of y = " + y);
} // Variable "y" goes out of scope when the "if" block (level 3) ends.
// "y" has gone out of scope, and is no longer recognized by the compiler.
// If we try to reference "y" in a subsequent statement, the compiler will
// generate an error. "x", on the other hand, remains in scope until the main
// method block (level 2) ends.
System.out.println("The value of x = " + x); // This will compile.
System.out.println("The value of y = " + y); // This WON'T compile.
} // Variable "x" goes out of scope when the main method block (level 2) ends.
}
Summary
ā€¢ Java is an elegant OO programming language that
improves upon many languages that preceded it.
ā€¢ Java was designed from the ground up to be fully
object-oriented.
ā€¢ Java is architecture neutral.
ā€¢ All of the facilities necessary for building industrial-
strength applications are integrated into the core Java
language.
ā€¢ Java is an open-source language.
ā€¢ Java can be downloaded for free from the Sun
Microsystems http://java.sun.com web site.
STUKTUR JAVA
(PRAKTIKUM MODUL 1-2)

More Related Content

What's hot

Java Presentation
Java PresentationJava Presentation
Java Presentation
pm2214
Ā 

What's hot (20)

Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Ā 
Java programming course for beginners
Java programming course for beginnersJava programming course for beginners
Java programming course for beginners
Ā 
Learn Java Part 1
Learn Java Part 1Learn Java Part 1
Learn Java Part 1
Ā 
Introduction to java technology
Introduction to java technologyIntroduction to java technology
Introduction to java technology
Ā 
Java features
Java featuresJava features
Java features
Ā 
History of java'
History of java'History of java'
History of java'
Ā 
Java basics notes
Java basics notesJava basics notes
Java basics notes
Ā 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and Runtime
Ā 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
Ā 
Java Presentation
Java PresentationJava Presentation
Java Presentation
Ā 
The Java Story
The Java StoryThe Java Story
The Java Story
Ā 
Java 3 rd sem. 2012 aug.ASSIGNMENT
Java 3 rd sem. 2012 aug.ASSIGNMENTJava 3 rd sem. 2012 aug.ASSIGNMENT
Java 3 rd sem. 2012 aug.ASSIGNMENT
Ā 
Java introduction with JVM architecture
Java introduction with JVM architectureJava introduction with JVM architecture
Java introduction with JVM architecture
Ā 
Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz Java history, versions, types of errors and exception, quiz
Java history, versions, types of errors and exception, quiz
Ā 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology
Ā 
What is-java
What is-javaWhat is-java
What is-java
Ā 
Java basic introduction
Java basic introductionJava basic introduction
Java basic introduction
Ā 
Java architecture
Java architectureJava architecture
Java architecture
Ā 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
Ā 
J2EE Struts with Hibernate Framework
J2EE Struts with Hibernate FrameworkJ2EE Struts with Hibernate Framework
J2EE Struts with Hibernate Framework
Ā 

Viewers also liked

03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays
tameemyousaf
Ā 
Computer Programming - Lecture 2
Computer Programming - Lecture 2Computer Programming - Lecture 2
Computer Programming - Lecture 2
Dr. Md. Shohel Sayeed
Ā 

Viewers also liked (10)

Program design techniques
Program design techniquesProgram design techniques
Program design techniques
Ā 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays
Ā 
Stack Data Structure V1.0
Stack Data Structure V1.0Stack Data Structure V1.0
Stack Data Structure V1.0
Ā 
Data Structure (Stack)
Data Structure (Stack)Data Structure (Stack)
Data Structure (Stack)
Ā 
Computer Programming- Lecture 3
Computer Programming- Lecture 3Computer Programming- Lecture 3
Computer Programming- Lecture 3
Ā 
Computer Programming - Lecture 2
Computer Programming - Lecture 2Computer Programming - Lecture 2
Computer Programming - Lecture 2
Ā 
A complete course in Program Design using Pseudocode
A complete course in Program Design using Pseudocode A complete course in Program Design using Pseudocode
A complete course in Program Design using Pseudocode
Ā 
6. Linked list - Data Structures using C++ by Varsha Patil
6. Linked list - Data Structures using C++ by Varsha Patil6. Linked list - Data Structures using C++ by Varsha Patil
6. Linked list - Data Structures using C++ by Varsha Patil
Ā 
Linked list
Linked listLinked list
Linked list
Ā 
Stacks
StacksStacks
Stacks
Ā 

Similar to It 405 materi 2 java dasar

JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
Murugesh33
Ā 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
prat0ham
Ā 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
Harry Potter
Ā 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
James Wong
Ā 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Luis Goldster
Ā 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
Tony Nguyen
Ā 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Young Alista
Ā 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Fraboni Ec
Ā 
PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.ppt
CDSukte
Ā 

Similar to It 405 materi 2 java dasar (20)

Introduction java programming
Introduction java programmingIntroduction java programming
Introduction java programming
Ā 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
Ā 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
Ā 
Java ms harsha
Java ms harshaJava ms harsha
Java ms harsha
Ā 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
Ā 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
Ā 
OOPS JAVA.pdf
OOPS JAVA.pdfOOPS JAVA.pdf
OOPS JAVA.pdf
Ā 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
Ā 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Ā 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Ā 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
Ā 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
Ā 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Ā 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Ā 
Introduction to java programming part 1
Introduction to java programming   part 1Introduction to java programming   part 1
Introduction to java programming part 1
Ā 
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
Ā 
PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.ppt
Ā 
PPS Java Overview Unit I.ppt
PPS Java Overview Unit I.pptPPS Java Overview Unit I.ppt
PPS Java Overview Unit I.ppt
Ā 
1 java introduction
1 java introduction1 java introduction
1 java introduction
Ā 
1 java intro
1 java intro1 java intro
1 java intro
Ā 

More from Ayi Purbasari

It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
Ayi Purbasari
Ā 
Using uml to model immune system
Using uml to model immune systemUsing uml to model immune system
Using uml to model immune system
Ayi Purbasari
Ā 

More from Ayi Purbasari (8)

Clonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpressClonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpress
Ā 
It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
Ā 
It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
Ā 
It 405 materi 4 objek dan kelas ii
It 405 materi 4   objek dan kelas iiIt 405 materi 4   objek dan kelas ii
It 405 materi 4 objek dan kelas ii
Ā 
It 405 materi 3 objek dan kelas
It 405 materi 3   objek dan kelasIt 405 materi 3   objek dan kelas
It 405 materi 3 objek dan kelas
Ā 
It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
Ā 
Using uml to model immune system
Using uml to model immune systemUsing uml to model immune system
Using uml to model immune system
Ā 
Pascapositivisme
Pascapositivisme Pascapositivisme
Pascapositivisme
Ā 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
Ā 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
Ā 

Recently uploaded (20)

šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Ā 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Ā 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
Ā 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
Ā 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Ā 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Ā 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Ā 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Ā 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Ā 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Ā 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Ā 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Ā 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Ā 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
Ā 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Ā 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Ā 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Ā 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Ā 
Scaling API-first ā€“ The story of a global engineering organization
Scaling API-first ā€“ The story of a global engineering organizationScaling API-first ā€“ The story of a global engineering organization
Scaling API-first ā€“ The story of a global engineering organization
Ā 

It 405 materi 2 java dasar

  • 1. IT 405: KPLBO Review Java Dasar Ayi Purbasari, ST., MT. Unpas, 2014
  • 2. Outline Primitive Java types, operators on those types, and expressions formed with those types The anatomy of a simple Java program The mechanics of compiling and running such programs Javaā€™s block-structured nature Various types of Java expressions Loops and other flow control structures Printing messages to the command window from which a program was launched, which is especially useful for testing code as it evolves Elements of Java programming style
  • 4. Java ā€¢ Java is a computer programming language that is concurrent, class-based,object-oriented, and specifically designed to have as few implementation dependencies as possible. ā€¢ It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. ā€¢ Java applications are typicallycompiled to bytecode (class file) that can run on any Java virtual machine (JVM) regardless of computer architecture.
  • 5. Java ā€¢ Java is, as of 2014, one of the most popular programming languages in use, particularly for client- server web applications, with a reported 9 million developers. ā€¢ Java was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. ā€¢ The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.
  • 6. TIOBE Index for February 2014 http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
  • 8.
  • 10. James Gosling ā€¢ born May 19, 1955 ā€¢ Carnegie Mellon University University of Calgary ā€¢ Canadian
  • 11. History ā€¢ Sun Microsystems released the first public implementation as Java 1.0 in 1995.[1] ā€¢ It promised "Write Once, Run Anywhere" (WORA), providing no-cost run- times on popularplatforms. ā€¢ Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. ā€¢ Major web browsers soon incorporated the ability to run Java appletswithin web pages, and Java quickly became popular. ā€¢ With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 ā€“ 1999), new versions had multiple configurations built for different types of platforms. ā€¢ For example, J2EE targeted enterprise applications and the greatly stripped-down version J2ME for mobile applications (Mobile Java). ā€¢ J2SEdesignated the Standard Edition. In 2006, for marketing purposes, Sun renamed new J2versions as Java EE, Java ME, and Java SE, respectively.
  • 12. Principles ā€¢ There were five primary goals in the creation of the Java language:[ ā€¢ It should be "simple, object-oriented and familiar" ā€¢ It should be "robust and secure" ā€¢ It should be "architecture-neutral and portable" ā€¢ It should execute with "high performance" ā€¢ It should be "interpreted, threaded, and dynamic"
  • 13. Version JDK 1.0 (January 21, 1996) JDK 1.1 (February 19, 1997) J2SE 1.2 (December 8, 1998) J2SE 1.3 (May 8, 2000) J2SE 1.4 (February 6, 2002)
  • 14. Version .. (lanjutan) J2SE 5.0 (September 30, 2004) Java SE 6 (December 11, 2006) Java SE 7 (July 28, 2011) Java SE 8 (March 18, 2014)
  • 15. Java (software platform) Original author(s) James Gosling, Sun Microsystems Developer(s) Oracle Corporation Stable release 7 Update 51 (1.7.0_51)(January 14, 2014; 33 days ago) Preview release 8 Build 129 (February 11, 2014; 5 days ago) [Ā±] Written in Java, C++ Operating system Windows, Solaris, Linux,OS X Platform IA-32, x86-64, SPARC,ARM Type Software platform License Freeware, mostly open-source, with a fewproprietary [7] components Website www.java.com
  • 16. Edisi Java ā€¢ Java Card ā€¢ Micro Edition (ME) ā€¢ Standard Edition (SE) ā€¢ Enterprise Edition (EE) ā€¢ JavaFX ā€¢ PersonalJava (discontinued)
  • 17. Standard Edition (SE) ā€¢ General purpose packages ā€“ java.lang ā€“ java.io ā€“ java.nio ā€“ java.math ā€“ java.net ā€“ java.text ā€“ java.util ā€¢ Special purpose packages ā€“ java.applet ā€“ java.beans ā€“ java.awt ā€“ java.rmi ā€“ java.security ā€“ java.sql ā€“ javax.rmi ā€“ javax.swing ā€“ javax.swing.text.html.parse r ā€“ javax.xml.bind.annotation
  • 18. Java platform ā€¢ One characteristic of Java is portability, which means that computer programs written in the Java language must run similarly on any hardware/operating-system platform. ā€¢ This is achieved by compiling the Java language code to an intermediate representation called Java bytecode, instead of directly to platform-specific machine code. ā€¢ Java bytecode instructions are analogous to machine code, but they are intended to be interpreted by a virtual machine (VM) written specifically for the host hardware. ā€¢ End-users commonly use a Java Runtime Environment (JRE) installed on their own machine for standalone Java applications, or in a Web browser for Java applets.
  • 19. Java Virtual Machine ā€¢ The JVM is a special piece of software that knows how to interpret and execute Java bytecode
  • 23. Hello World ! ā€¢ Praktek membuat hello world, diperlihatkan struktur file, dan java bytecode.
  • 25. REVIEW Loops and Other Flow-Control Structures
  • 26. If Statement if (logical-expression-1) { execute this code } else { if (logical-expression-2) { execute this alternate code } else { execute this code if neither of the above expressions evaluate to true } } if (logical-expression-1) { execute this code } else if (logical-expression-2) { execute this alternate code } else { execute this code if neither of the above expressions evaluate to true }
  • 27. Switch Statement switch (int-or-char-expression) { case value1: one or more lines of code to execute if value of expression matches value1 break; case value2: one or more lines of code to execute if value of expression matches value2 break; // more case labels, as needed ... case valueN: one or more lines of code to execute if value of expression matches valueN break; default: default code to execute if none of the cases match }
  • 28. For Statement for (initializer; condition; iterator) { code to execute while condition evaluates to true } public class ForDemo { public static void main(String[] args) { // Compute a simple multiplication table. for (int j = 1; j <= 4; j++) { for (int k = 1; k <= 4; k++) { System.out.println(j + " * " + k + " = " + (j * k)); } } } }
  • 29. while Statements while (condition) { code to repeatedly execute while condition continues to evaluate to true } public class WhileDemo { public static void main(String[] args) { boolean finished = false; int i = 0; while (!finished) { System.out.println(i); i++; if (i == 4) finished = true; // toggle the flag to terminate the loop } } }
  • 30. Block-Structured Languages and the Scope of a Variable public class ScopeExample { // Start of block level 1. public static void main(String[] args) { // Start of block level 2. double x = 2.0; // Declare "x" at block level 2. if (x < 5.0) { // Start of block level 3. double y = 1.0; // Declare "y" inside block level 3. System.out.println("The value of x = " + x); // x, declared at level 2, is // still in scope at level 3. System.out.println("The value of y = " + y); } // Variable "y" goes out of scope when the "if" block (level 3) ends. // "y" has gone out of scope, and is no longer recognized by the compiler. // If we try to reference "y" in a subsequent statement, the compiler will // generate an error. "x", on the other hand, remains in scope until the main // method block (level 2) ends. System.out.println("The value of x = " + x); // This will compile. System.out.println("The value of y = " + y); // This WON'T compile. } // Variable "x" goes out of scope when the main method block (level 2) ends. }
  • 31. Summary ā€¢ Java is an elegant OO programming language that improves upon many languages that preceded it. ā€¢ Java was designed from the ground up to be fully object-oriented. ā€¢ Java is architecture neutral. ā€¢ All of the facilities necessary for building industrial- strength applications are integrated into the core Java language. ā€¢ Java is an open-source language. ā€¢ Java can be downloaded for free from the Sun Microsystems http://java.sun.com web site.