SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaiUnmesh Baile
 
Python intro and competitive programming
Python intro and competitive programmingPython intro and competitive programming
Python intro and competitive programmingSuraj Shah
 
Java Programming and J2ME: The Basics
Java Programming and J2ME: The BasicsJava Programming and J2ME: The Basics
Java Programming and J2ME: The Basicstosine
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Railselliando dias
 
Integrating Doctrine with Laravel
Integrating Doctrine with LaravelIntegrating Doctrine with Laravel
Integrating Doctrine with LaravelMark Garratt
 
Java 201 Intro to Test Driven Development in Java
Java 201   Intro to Test Driven Development in JavaJava 201   Intro to Test Driven Development in Java
Java 201 Intro to Test Driven Development in Javaagorolabs
 
OCCIware
OCCIwareOCCIware
OCCIwareOCCIware
 

Was ist angesagt? (12)

Java intro
Java introJava intro
Java intro
 
Java01
Java01Java01
Java01
 
RIBBUN SOFTWARE
RIBBUN SOFTWARERIBBUN SOFTWARE
RIBBUN SOFTWARE
 
Java
JavaJava
Java
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
 
Python intro and competitive programming
Python intro and competitive programmingPython intro and competitive programming
Python intro and competitive programming
 
Java
JavaJava
Java
 
Java Programming and J2ME: The Basics
Java Programming and J2ME: The BasicsJava Programming and J2ME: The Basics
Java Programming and J2ME: The Basics
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Rails
 
Integrating Doctrine with Laravel
Integrating Doctrine with LaravelIntegrating Doctrine with Laravel
Integrating Doctrine with Laravel
 
Java 201 Intro to Test Driven Development in Java
Java 201   Intro to Test Driven Development in JavaJava 201   Intro to Test Driven Development in Java
Java 201 Intro to Test Driven Development in Java
 
OCCIware
OCCIwareOCCIware
OCCIware
 

Ähnlich wie Getting Started with Java

1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
Intro to java programming
Intro to java programmingIntro to java programming
Intro to java programmingEugene Stephens
 
j-chap1-Basics.ppt
j-chap1-Basics.pptj-chap1-Basics.ppt
j-chap1-Basics.pptSmitaBorkar9
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaAbhishekMondal42
 
ITFT - Java Coding
ITFT - Java CodingITFT - Java Coding
ITFT - Java CodingBlossom Sood
 
Java overview and architecture
Java overview and architectureJava overview and architecture
Java overview and architectureWeei-Jye Chay
 
1java Introduction
1java Introduction1java Introduction
1java IntroductionAdil Jafri
 
Scala Introduction
Scala IntroductionScala Introduction
Scala IntroductionAdrian Spender
 
Comp102 lec 3
Comp102   lec 3Comp102   lec 3
Comp102 lec 3Fraz Bakhsh
 
Java introduction by lara technologies
Java introduction by lara technologiesJava introduction by lara technologies
Java introduction by lara technologiestechnologieslara
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013DuckMa
 
Getting started with C++
Getting started with C++Getting started with C++
Getting started with C++Michael Redlich
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayLuka ZakrajĹĄek
 
Getting Started with C++
Getting Started with C++Getting Started with C++
Getting Started with C++Michael Redlich
 

Ähnlich wie Getting Started with Java (20)

1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
Intro to java programming
Intro to java programmingIntro to java programming
Intro to java programming
 
java slides
java slidesjava slides
java slides
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
j-chap1-Basics.ppt
j-chap1-Basics.pptj-chap1-Basics.ppt
j-chap1-Basics.ppt
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Building XWiki
Building XWikiBuilding XWiki
Building XWiki
 
ITFT - Java Coding
ITFT - Java CodingITFT - Java Coding
ITFT - Java Coding
 
Java overview and architecture
Java overview and architectureJava overview and architecture
Java overview and architecture
 
1java Introduction
1java Introduction1java Introduction
1java Introduction
 
Scala Introduction
Scala IntroductionScala Introduction
Scala Introduction
 
Comp102 lec 3
Comp102   lec 3Comp102   lec 3
Comp102 lec 3
 
Java introduction by lara technologies
Java introduction by lara technologiesJava introduction by lara technologies
Java introduction by lara technologies
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
Getting started with C++
Getting started with C++Getting started with C++
Getting started with C++
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
 
Getting Started with C++
Getting Started with C++Getting Started with C++
Getting Started with C++
 

Mehr von Michael Redlich

Getting Started with GitHub
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHubMichael Redlich
 
Building Microservices with Micronaut: A Full-Stack JVM-Based Framework
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
 
Building Microservices with Helidon: Oracle's New Java Microservices Framework
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
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced FeaturesMichael Redlich
 
Java Advanced Features
Java Advanced FeaturesJava Advanced Features
Java Advanced FeaturesMichael Redlich
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced FeaturesMichael Redlich
 
Building Realtime Access to Data Apps with jOOQ
Building Realtime Access to Data Apps with jOOQBuilding Realtime Access to Data Apps with jOOQ
Building Realtime Access to Data Apps with jOOQMichael 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)
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)Michael Redlich
 
Building Realtime Web Apps with Angular and Meteor
Building Realtime Web Apps with Angular and MeteorBuilding Realtime Web Apps with Angular and Meteor
Building Realtime Web Apps with Angular and MeteorMichael Redlich
 
Java Advanced Features (TCF 2014)
Java Advanced Features (TCF 2014)Java Advanced Features (TCF 2014)
Java Advanced Features (TCF 2014)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)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)Michael Redlich
 
Getting Started with Meteor (TCF ITPC 2014)
Getting Started with Meteor (TCF ITPC 2014)Getting Started with Meteor (TCF ITPC 2014)
Getting Started with Meteor (TCF ITPC 2014)Michael Redlich
 
Getting Started with C++ (TCF 2014)
Getting Started with C++ (TCF 2014)Getting Started with C++ (TCF 2014)
Getting Started with C++ (TCF 2014)Michael Redlich
 
C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)Michael Redlich
 
Getting Started with MongoDB (TCF ITPC 2014)
Getting Started with MongoDB (TCF ITPC 2014)Getting Started with MongoDB (TCF ITPC 2014)
Getting Started with MongoDB (TCF ITPC 2014)Michael Redlich
 
Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDBMichael Redlich
 
Getting Started with Meteor
Getting Started with MeteorGetting Started with Meteor
Getting Started with MeteorMichael Redlich
 

Mehr von Michael Redlich (17)

Getting Started with GitHub
Getting Started with GitHubGetting Started with GitHub
Getting Started with GitHub
 
Building Microservices with Micronaut: A Full-Stack JVM-Based Framework
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
 
Building Microservices with Helidon: Oracle's New Java Microservices Framework
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
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced Features
 
Java Advanced Features
Java Advanced FeaturesJava Advanced Features
Java Advanced Features
 
C++ Advanced Features
C++ Advanced FeaturesC++ Advanced Features
C++ Advanced Features
 
Building Realtime Access to Data Apps with jOOQ
Building Realtime Access to Data Apps with jOOQBuilding Realtime Access to Data Apps with jOOQ
Building Realtime Access to Data Apps with jOOQ
 
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)
Building Realtime Access Data Apps with Speedment (TCF ITPC 2017)
 
Building Realtime Web Apps with Angular and Meteor
Building Realtime Web Apps with Angular and MeteorBuilding Realtime Web Apps with Angular and Meteor
Building Realtime Web Apps with Angular and Meteor
 
Java Advanced Features (TCF 2014)
Java Advanced Features (TCF 2014)Java Advanced Features (TCF 2014)
Java Advanced Features (TCF 2014)
 
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)
Introduction to Object-Oriented Programming & Design Principles (TCF 2014)
 
Getting Started with Meteor (TCF ITPC 2014)
Getting Started with Meteor (TCF ITPC 2014)Getting Started with Meteor (TCF ITPC 2014)
Getting Started with Meteor (TCF ITPC 2014)
 
Getting Started with C++ (TCF 2014)
Getting Started with C++ (TCF 2014)Getting Started with C++ (TCF 2014)
Getting Started with C++ (TCF 2014)
 
C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)C++ Advanced Features (TCF 2014)
C++ Advanced Features (TCF 2014)
 
Getting Started with MongoDB (TCF ITPC 2014)
Getting Started with MongoDB (TCF ITPC 2014)Getting Started with MongoDB (TCF ITPC 2014)
Getting Started with MongoDB (TCF ITPC 2014)
 
Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDB
 
Getting Started with Meteor
Getting Started with MeteorGetting Started with Meteor
Getting Started with Meteor
 

KĂźrzlich hochgeladen

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp KrisztiĂĄn
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 

KĂźrzlich hochgeladen (20)

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 

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-dened 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 • Denes 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-dened 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 le 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