Getting Started with Java

Michael Redlich
Michael RedlichSystems Analyst, Polymer Physicist at Amateur Computer Group of New Jersey
1
Getting Started with
Java
Trenton Computer Festival
March 17, 2018
Michael P. Redlich
@mpredli
about.me/mpredli/
Who’s Mike?
• BS in CS from
• “Petrochemical Research Organization”
• Java Queue News Editor, InfoQ
• Ai-Logix, Inc. (now AudioCodes)
• Amateur Computer Group of New Jersey
2
Objectives (1)
• What is Java??
• Evolution of Java
• Features of Java
• Review of Object-Oriented Programming
(OOP)
3
Objectives (2)
• Getting Started with Java
• introduction to the Java class mechanism
• how to implement Java classes
• Live Demos (yea!)
• Java Resources
4
What is Java?
• “Java is C++ without guns, knives, and clubs.”
James Gosling,“father” of Java, Sun Microsystems
• “Java is simple, object-oriented, distributed,
interpreted, robust, secure, architecture neutral,
portable, high performance, multithreaded
dynamic language.”
Sun Microsystems
5
Evolution of Java (1)
• Created by James Gosling (with Patrick
Naughton)
• Sun Microsystems
• 1991 - originally named “Oak”
• consumer applications
• architecture agnostic
• object-oriented
6
Evolution of Java (2)
• 1994 - Project “*7” dissolved
• but in the meantime...
• 1995 - Java introduced at Sun World ’95
• HotJava browser
7
Features of Java
• Object-Oriented
Programming (OOP)
Language
• Documentation
Generation
• Applets and Applications
• Comprehensive
Exception Handling
• Java Database
Connectivity (JDBC)
• Java Beans
• Enterprise Java Beans
• No pointers!!
8
OOP Review (1)
• Programming Paradigm
• Four (4) Main Attributes
• data encapsulation
• data abstraction
• inheritance
• polymorphism
9
OOP Review (2)
• Abstract Data Type (ADT)
• user-defined data type
• use of objects through functions (methods)
without knowing the internal representation
10
OOP Review (3)
• Interface
• functions (methods) provided in the ADT that
allow access to data
• Implementation
• underlying data structure(s) and business logic
within the ADT
11
OOP Review (4)
• Class
• Defines a model
• Declares attributes
• Declares behavior
• Is an ADT
• Object
• Is an instance of a class
• Has state
• Has behavior
• May have many unique
objects of the same class
12
Advantages of OOP
• Interface can (and should) remain
unchanged when improving implementation
• Encourages modularity in application
development
• Better maintainability of code
• Code reuse
• Emphasis on what, not how
13
Some Java Keywords
• class
• new
• private,
protected, public,
package
• try, throw, catch,
finally
• final
• extends
• implements
• abstract
• interface
14
Classes (1)
• A user-defined abstract data type
• Extension of C structs
• Contain:
• constructor
• data members and member functions (methods)
15
Classes (2)
• Dynamic object instantiation
• Multiple Constructors:
• Sports();
• Sports(String,int,int);
• Sports(float,String,int);
16
Classes (3)
• Abstract Classes
• contain at least one pure virtual member
function (C++)
• contain at least one abstract method (Java)
17
Abstract Classes
• Pure virtual member function (C++)
• virtual void draw() = 0;
• Abstract method (Java)
• public abstract void draw();
18
Class Inheritance
19
Hello,World!
20
source: http://www.codejava.net/java-core/how-to-write-compile-and-run-a-hello-world-java-
program-for-beginners
21
// Sports class (partial listing)
public class Sports {
private String team;
private int win;
public Sports() {
// define default constructor here...
}
public Sports(String team,int win,int loss) {
// define primary constructor here...
}
public int getWin() {
return win;
}
}
22
// Baseball class (partial listing)
class Baseball extends Sports {
public Baseball() {
// define default constructor here...
}
Baseball(String team,int win,int loss) {
// define primary constructor here...
}
}
Dynamic Instantiation
• Object creation:
• Baseball mets = new
Baseball(“Mets”,97,65);
• Access to public member functions:
• mets.getWin(); // returns 97
23
Deleting Objects
Baseball mets = new
Baseball(“Mets”,97,65);
// automatic garbage collection or:
System.gc(); // explicit call
24
Java Development Kit
(JDK)
• Available from Oracle web site
• java.sun.com
• Java SE (standard edition)
• latest version - Java 9.0.4
• Java 10 available on March 20, 2018
• Documentation in full HTML format
25
Working with Java (1)
• Setup environment and path:
• set JAVA_HOME=path
• set PATH=%PATH%;%JAVA_HOME%bin
• export JAVA_HOME=path
• export PATH=$JAVA_HOME/bin
26
Working with Java (2)
• Source code
• .java extension
• Intermediate bytecode
• .class extension generated after successful
compilation
• Bytecode interprested by JavaVirtual
Machine (JVM)
27
Working with Java (3)
• Compile Java source code:
• javac -Xlint:all -d path
filename.java
• Run the application:
• java -classpath path filename
28
Working with Java (4)
• Run the applet:
• in browser via HTML file within <applet></
applet> tags
• appletviewer path filename.html
29
Directories and
Packages (2)
• Consistent directory structure
• source code (*.java)
• byte code (*.class)
• Map directories with package name
• under the src folder
30
Directories and
Packages (2)
/usr/local/apps/java-apps
↳java-apps
↳tcf
↳hello
↳src
↳org
↳tcf
↳hello
31
package org.tcf.hello;➜
Demo Time…
32
Java IDEs (1)
• IntelliJ IDEA 2017.3
•jetbrains.com/idea
• stay tuned for version 2018.1 coming soon
• Eclipse IDE
•eclipse.org/ide
33
Java IDEs (2)
• NetBeans 8.2
•netbeans.org
• currently being moved from Oracle to Apache
34
Local Java User Groups
(1)
• ACGNJ Java Users Group
• facilitated by Mike Redlich
• javasig.org
• Princeton Java Users Group
• facilitated byYakov Fain
• meetup.com/NJFlex
35
Local Java User Groups
(2)
• NYJavaSIG
• facilitated by Frank Greco
• javasig.com
• PhillyJUG
• facilitated by Martin Snyder, et. al.
• meetup.com/PhillyJUG
36
Local Java User Groups
(3)
• Capital District Java Developers Network
• facilitated by Dan Patsey
• cdjdn.com
• currently restructuring
37
Further Reading
38
Upcoming Events
• ACGNJ Java Users Group
• Dr. Venkat Subramaniam
• Monday, March 19, 2018
• DorothyYoung Center for the Arts, Room 106
• Drew University
• 7:30-9:00pm
• “Twelve Ways to Make Code Suck Less”
39
40
Thanks!
mike@redlich.net
@mpredli
redlich.net
slideshare.net/mpredli01
github.com/mpredli01
Upcoming Events
• March 17-18, 2017
•tcf-nj.org
• April 18-19, 2017
•phillyemergingtech.com
41
1 of 41

Recommended

Getting Started with Java (TCF 2014) by
Getting Started with Java (TCF 2014)Getting Started with Java (TCF 2014)
Getting Started with Java (TCF 2014)Michael Redlich
777 views39 slides
Introduction to Object Oriented Programming & Design Principles by
Introduction to Object Oriented Programming & Design PrinciplesIntroduction to Object Oriented Programming & Design Principles
Introduction to Object Oriented Programming & Design PrinciplesMichael Redlich
377 views59 slides
Introduction to Object Oriented Programming &amp; Design Principles by
Introduction to Object Oriented Programming &amp; Design PrinciplesIntroduction to Object Oriented Programming &amp; Design Principles
Introduction to Object Oriented Programming &amp; Design PrinciplesMichael Redlich
117 views59 slides
Intro to java programming by
Intro to java programmingIntro to java programming
Intro to java programmingLeah Stephens
223 views19 slides
Development of Java tools using SWT and WALA af Hans Søndergaard, ViaUC by
Development of Java tools using SWT and WALA af Hans Søndergaard, ViaUCDevelopment of Java tools using SWT and WALA af Hans Søndergaard, ViaUC
Development of Java tools using SWT and WALA af Hans Søndergaard, ViaUCInfinIT - Innovationsnetværket for it
631 views13 slides
Introduction what is java by
Introduction what is javaIntroduction what is java
Introduction what is javasanjeeviniindia1186
329 views22 slides

More Related Content

What's hot

Java intro by
Java introJava intro
Java introSonam Sharma
378 views22 slides
Java01 by
Java01Java01
Java01Remon Hanna
260 views22 slides
RIBBUN SOFTWARE by
RIBBUN SOFTWARERIBBUN SOFTWARE
RIBBUN SOFTWAREmosewoodward24
196 views22 slides
java-corporate-training-institute-in-mumbai by
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaiUnmesh Baile
181 views24 slides
Python intro and competitive programming by
Python intro and competitive programmingPython intro and competitive programming
Python intro and competitive programmingSuraj Shah
99 views65 slides

Similar to Getting Started with Java

1 java programming- introduction by
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
1.2K views64 slides
Intro to java programming by
Intro to java programmingIntro to java programming
Intro to java programmingEugene Stephens
943 views19 slides
java slides by
java slidesjava slides
java slidesRizwanTariq18
5 views29 slides
Introduction to JAVA by
Introduction to JAVAIntroduction to JAVA
Introduction to JAVAMd. Tanvir Hossain
420 views26 slides
j-chap1-Basics.ppt by
j-chap1-Basics.pptj-chap1-Basics.ppt
j-chap1-Basics.pptSmitaBorkar9
3 views27 slides
Java Introduction by
Java IntroductionJava Introduction
Java Introductionsunmitraeducation
4K views19 slides

Similar to Getting Started with Java(20)

1 java programming- introduction by jyoti_lakhani
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
jyoti_lakhani1.2K views
Why we love Clojure? GeekOut 2018 presentation by Solita Oy
Why we love Clojure? GeekOut 2018 presentationWhy we love Clojure? GeekOut 2018 presentation
Why we love Clojure? GeekOut 2018 presentation
Solita Oy1.9K views
Java overview and architecture by Weei-Jye Chay
Java overview and architectureJava overview and architecture
Java overview and architecture
Weei-Jye Chay129 views
1java Introduction by Adil Jafri
1java Introduction1java Introduction
1java Introduction
Adil Jafri104 views
Java introduction by lara technologies by technologieslara
Java introduction by lara technologiesJava introduction by lara technologies
Java introduction by lara technologies
technologieslara170 views
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013 by DuckMa
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
DuckMa665 views
Typesafe stack - Scala, Akka and Play by Luka Zakrajšek
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
Luka Zakrajšek3.3K views

More from Michael Redlich

Getting Started with GitHub by
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHubMichael Redlich
153 views30 slides
Building Microservices with Micronaut: A Full-Stack JVM-Based Framework by
Building Microservices with Micronaut:  A Full-Stack JVM-Based FrameworkBuilding Microservices with Micronaut:  A Full-Stack JVM-Based Framework
Building Microservices with Micronaut: A Full-Stack JVM-Based FrameworkMichael Redlich
415 views55 slides
Building Microservices with Helidon: Oracle's New Java Microservices Framework by
Building Microservices with Helidon:  Oracle's New Java Microservices FrameworkBuilding Microservices with Helidon:  Oracle's New Java Microservices Framework
Building Microservices with Helidon: Oracle's New Java Microservices FrameworkMichael Redlich
274 views58 slides
Getting Started with C++ by
Getting Started with C++Getting Started with C++
Getting Started with C++Michael Redlich
249 views39 slides
C++ Advanced Features by
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced FeaturesMichael Redlich
280 views62 slides
Java Advanced Features by
Java Advanced FeaturesJava Advanced Features
Java Advanced FeaturesMichael Redlich
250 views47 slides

More from Michael Redlich(18)

Building Microservices with Micronaut: A Full-Stack JVM-Based Framework by Michael Redlich
Building Microservices with Micronaut:  A Full-Stack JVM-Based FrameworkBuilding Microservices with Micronaut:  A Full-Stack JVM-Based Framework
Building Microservices with Micronaut: A Full-Stack JVM-Based Framework
Michael Redlich415 views
Building Microservices with Helidon: Oracle's New Java Microservices Framework by Michael Redlich
Building Microservices with Helidon:  Oracle's New Java Microservices FrameworkBuilding Microservices with Helidon:  Oracle's New Java Microservices Framework
Building Microservices with Helidon: Oracle's New Java Microservices Framework
Michael Redlich274 views
Building Realtime Access to Data Apps with jOOQ by Michael Redlich
Building Realtime Access to Data Apps with jOOQBuilding Realtime Access to Data Apps with jOOQ
Building Realtime Access to Data Apps with jOOQ
Michael Redlich225 views
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017) by Michael Redlich
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)
Michael Redlich281 views
Building Realtime Web Apps with Angular and Meteor by Michael Redlich
Building Realtime Web Apps with Angular and MeteorBuilding Realtime Web Apps with Angular and Meteor
Building Realtime Web Apps with Angular and Meteor
Michael Redlich319 views
Java Advanced Features (TCF 2014) by Michael Redlich
Java Advanced Features (TCF 2014)Java Advanced Features (TCF 2014)
Java Advanced Features (TCF 2014)
Michael Redlich754 views
Introduction to Object-Oriented Programming & Design Principles (TCF 2014) by Michael Redlich
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
Michael Redlich2.4K views
Getting Started with Meteor (TCF ITPC 2014) by Michael Redlich
Getting Started with Meteor (TCF ITPC 2014)Getting Started with Meteor (TCF ITPC 2014)
Getting Started with Meteor (TCF ITPC 2014)
Michael Redlich902 views
Getting Started with C++ (TCF 2014) by Michael Redlich
Getting Started with C++ (TCF 2014)Getting Started with C++ (TCF 2014)
Getting Started with C++ (TCF 2014)
Michael Redlich1.3K views
C++ Advanced Features (TCF 2014) by Michael Redlich
C++ Advanced Features (TCF 2014)C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)
Michael Redlich1.4K views
Getting Started with MongoDB (TCF ITPC 2014) by Michael Redlich
Getting Started with MongoDB (TCF ITPC 2014)Getting Started with MongoDB (TCF ITPC 2014)
Getting Started with MongoDB (TCF ITPC 2014)
Michael Redlich2.2K views

Recently uploaded

A first look at MariaDB 11.x features and ideas on how to use them by
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use themFederico Razzoli
44 views36 slides
DSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - Parker by
DSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - ParkerDSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - Parker
DSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - ParkerDeltares
8 views16 slides
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... by
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...Deltares
9 views26 slides
Consulting for Data Monetization Maximizing the Profit Potential of Your Data... by
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...Flexsin
15 views10 slides
Software evolution understanding: Automatic extraction of software identifier... by
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...Ra'Fat Al-Msie'deen
7 views33 slides
MariaDB stored procedures and why they should be improved by
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improvedFederico Razzoli
8 views32 slides

Recently uploaded(20)

A first look at MariaDB 11.x features and ideas on how to use them by Federico Razzoli
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them
Federico Razzoli44 views
DSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - Parker by Deltares
DSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - ParkerDSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - Parker
DSD-INT 2023 SFINCS Modelling in the U.S. Pacific Northwest - Parker
Deltares8 views
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... by Deltares
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
Deltares9 views
Consulting for Data Monetization Maximizing the Profit Potential of Your Data... by Flexsin
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Flexsin 15 views
Software evolution understanding: Automatic extraction of software identifier... by Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
MariaDB stored procedures and why they should be improved by Federico Razzoli
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improved
Software testing company in India.pptx by SakshiPatel82
Software testing company in India.pptxSoftware testing company in India.pptx
Software testing company in India.pptx
SakshiPatel827 views
Cycleops - Automate deployments on top of bare metal.pptx by Thanassis Parathyras
Cycleops - Automate deployments on top of bare metal.pptxCycleops - Automate deployments on top of bare metal.pptx
Cycleops - Automate deployments on top of bare metal.pptx
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... by Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri643 views
Citi TechTalk Session 2: Kafka Deep Dive by confluent
Citi TechTalk Session 2: Kafka Deep DiveCiti TechTalk Session 2: Kafka Deep Dive
Citi TechTalk Session 2: Kafka Deep Dive
confluent17 views
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... by Deltares
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
Deltares6 views
Les nouveautés produit Neo4j by Neo4j
 Les nouveautés produit Neo4j Les nouveautés produit Neo4j
Les nouveautés produit Neo4j
Neo4j27 views
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
Deltares12 views
How to Make the Most of Regression and Unit Testing.pdf by Abhay Kumar
How to Make the Most of Regression and Unit Testing.pdfHow to Make the Most of Regression and Unit Testing.pdf
How to Make the Most of Regression and Unit Testing.pdf
Abhay Kumar10 views
What Can Employee Monitoring Software Do?​ by wAnywhere
What Can Employee Monitoring Software Do?​What Can Employee Monitoring Software Do?​
What Can Employee Monitoring Software Do?​
wAnywhere18 views

Getting Started with Java

  • 1. 1 Getting Started with Java Trenton Computer Festival March 17, 2018 Michael P. Redlich @mpredli about.me/mpredli/
  • 2. Who’s Mike? • BS in CS from • “Petrochemical Research Organization” • Java Queue News Editor, InfoQ • Ai-Logix, Inc. (now AudioCodes) • Amateur Computer Group of New Jersey 2
  • 3. Objectives (1) • What is Java?? • Evolution of Java • Features of Java • Review of Object-Oriented Programming (OOP) 3
  • 4. Objectives (2) • Getting Started with Java • introduction to the Java class mechanism • how to implement Java classes • Live Demos (yea!) • Java Resources 4
  • 5. What is Java? • “Java is C++ without guns, knives, and clubs.” James Gosling,“father” of Java, Sun Microsystems • “Java is simple, object-oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high performance, multithreaded dynamic language.” Sun Microsystems 5
  • 6. Evolution of Java (1) • Created by James Gosling (with Patrick Naughton) • Sun Microsystems • 1991 - originally named “Oak” • consumer applications • architecture agnostic • object-oriented 6
  • 7. Evolution of Java (2) • 1994 - Project “*7” dissolved • but in the meantime... • 1995 - Java introduced at Sun World ’95 • HotJava browser 7
  • 8. Features of Java • Object-Oriented Programming (OOP) Language • Documentation Generation • Applets and Applications • Comprehensive Exception Handling • Java Database Connectivity (JDBC) • Java Beans • Enterprise Java Beans • No pointers!! 8
  • 9. OOP Review (1) • Programming Paradigm • Four (4) Main Attributes • data encapsulation • data abstraction • inheritance • polymorphism 9
  • 10. OOP Review (2) • Abstract Data Type (ADT) • user-defined data type • use of objects through functions (methods) without knowing the internal representation 10
  • 11. OOP Review (3) • Interface • functions (methods) provided in the ADT that allow access to data • Implementation • underlying data structure(s) and business logic within the ADT 11
  • 12. OOP Review (4) • Class • Defines a model • Declares attributes • Declares behavior • Is an ADT • Object • Is an instance of a class • Has state • Has behavior • May have many unique objects of the same class 12
  • 13. Advantages of OOP • Interface can (and should) remain unchanged when improving implementation • Encourages modularity in application development • Better maintainability of code • Code reuse • Emphasis on what, not how 13
  • 14. Some Java Keywords • class • new • private, protected, public, package • try, throw, catch, finally • final • extends • implements • abstract • interface 14
  • 15. Classes (1) • A user-defined abstract data type • Extension of C structs • Contain: • constructor • data members and member functions (methods) 15
  • 16. Classes (2) • Dynamic object instantiation • Multiple Constructors: • Sports(); • Sports(String,int,int); • Sports(float,String,int); 16
  • 17. Classes (3) • Abstract Classes • contain at least one pure virtual member function (C++) • contain at least one abstract method (Java) 17
  • 18. Abstract Classes • Pure virtual member function (C++) • virtual void draw() = 0; • Abstract method (Java) • public abstract void draw(); 18
  • 21. 21 // Sports class (partial listing) public class Sports { private String team; private int win; public Sports() { // define default constructor here... } public Sports(String team,int win,int loss) { // define primary constructor here... } public int getWin() { return win; } }
  • 22. 22 // Baseball class (partial listing) class Baseball extends Sports { public Baseball() { // define default constructor here... } Baseball(String team,int win,int loss) { // define primary constructor here... } }
  • 23. Dynamic Instantiation • Object creation: • Baseball mets = new Baseball(“Mets”,97,65); • Access to public member functions: • mets.getWin(); // returns 97 23
  • 24. Deleting Objects Baseball mets = new Baseball(“Mets”,97,65); // automatic garbage collection or: System.gc(); // explicit call 24
  • 25. Java Development Kit (JDK) • Available from Oracle web site • java.sun.com • Java SE (standard edition) • latest version - Java 9.0.4 • Java 10 available on March 20, 2018 • Documentation in full HTML format 25
  • 26. Working with Java (1) • Setup environment and path: • set JAVA_HOME=path • set PATH=%PATH%;%JAVA_HOME%bin • export JAVA_HOME=path • export PATH=$JAVA_HOME/bin 26
  • 27. Working with Java (2) • Source code • .java extension • Intermediate bytecode • .class extension generated after successful compilation • Bytecode interprested by JavaVirtual Machine (JVM) 27
  • 28. Working with Java (3) • Compile Java source code: • javac -Xlint:all -d path filename.java • Run the application: • java -classpath path filename 28
  • 29. Working with Java (4) • Run the applet: • in browser via HTML file within <applet></ applet> tags • appletviewer path filename.html 29
  • 30. Directories and Packages (2) • Consistent directory structure • source code (*.java) • byte code (*.class) • Map directories with package name • under the src folder 30
  • 33. Java IDEs (1) • IntelliJ IDEA 2017.3 •jetbrains.com/idea • stay tuned for version 2018.1 coming soon • Eclipse IDE •eclipse.org/ide 33
  • 34. Java IDEs (2) • NetBeans 8.2 •netbeans.org • currently being moved from Oracle to Apache 34
  • 35. Local Java User Groups (1) • ACGNJ Java Users Group • facilitated by Mike Redlich • javasig.org • Princeton Java Users Group • facilitated byYakov Fain • meetup.com/NJFlex 35
  • 36. Local Java User Groups (2) • NYJavaSIG • facilitated by Frank Greco • javasig.com • PhillyJUG • facilitated by Martin Snyder, et. al. • meetup.com/PhillyJUG 36
  • 37. Local Java User Groups (3) • Capital District Java Developers Network • facilitated by Dan Patsey • cdjdn.com • currently restructuring 37
  • 39. Upcoming Events • ACGNJ Java Users Group • Dr. Venkat Subramaniam • Monday, March 19, 2018 • DorothyYoung Center for the Arts, Room 106 • Drew University • 7:30-9:00pm • “Twelve Ways to Make Code Suck Less” 39
  • 41. Upcoming Events • March 17-18, 2017 •tcf-nj.org • April 18-19, 2017 •phillyemergingtech.com 41