SlideShare a Scribd company logo
Core Java [An Introduction]
Presenter
Saurav Ghosh
Corporate Trainer/Technical Analyst
MTA|MCP|MCTS|MCT|Certified Hadoop
Developer
11+ Years of Experience in Corporate
Training and Application Development
Agenda
 Getting Started
 OOPs & Java as an Object Oriented Language
 Brief History
 Properties of Java
 Java naming conventions
 Java API packages
 Java data types
 Java operators
 Installation and configuration
 First Java program
Procedural vs Object Oriented
programming
 Use of functions
 Called
 Independent code
 Top - Down approach
of programming
 Use of methods
 Applied
 Dependent code
 Bottom - Up approach
of programming
Object Oriented
Paradigm[OOP’s]
 Data Hiding / Data Abstraction
 Encapsulation
 Classes & Objects
 Inheritance
 Dynamic Binding
 Polymorphism
 Message Passing
Object Oriented Programming :
is an area / field of OOP’s
implementation
Object Oriented Language
Categories
Object Oriented
 A program is a file
 main() is a function
 C++
Object Based
 A program is a class
or a module or an
assembly
 main() is a method
 Java / .NET / Visual
Basic
Brief History
 Java was developed by James Ghosling, Patrick
Naughton, Mike Sheridan at Sun Microsystems
Inc. in 1991.
 The initial name was Oak but it was renamed
to Java in 1995.
Versions
 Java 1.0 : initial launch
 Java 1.1 : redefined AWT event handling, new
library elements were added
 Java 1.2 : Swing and Collection framework was
added
 Java 1.3 : No major changes
 Java 1.4 : assert keyword added
Version 1.5 [J2SE 5]
 Generics
 Annotations
 Autoboxing and Autounboxing
 Formatted I/O
 For each loop,etc.
Java SE 7
 Now String can be used to control Switch
statement.
 Multi Catch Exception
 try-with-resource statement
 Binary Integer Literals
 Underscore in numeric literals, etc.
Java SE 8
 Lamda Expressions
 New Collection Package java.util.stream to provide
Stream API.
 Enhanced Security
 Nashorn Javascript Engine included
 Parallel Array Sorting
 The JDBC-ODBC Bridge has been removed etc.
Properties of Java
 Truly / Fully Object Oriented
 Compiled and Interpreted
 Platform Independent
 Robust & Extensible
 Automatically garbage collected
 Multi threaded programming
Applications of Java
 Developing Desktop Applications
 Web Applications like Linkedin.com,
Snapdeal.com etc
 Mobile Operating System like Android
 Embedded Systems
 Robotics and games etc
Java Virtual Machine [JVM]
 Java virtual Machine(JVM) is a virtual Machine
that provides runtime environment to execute
java byte code.
 JVM control execution of every Java program
 It enables features such as automated exception
handling, Garbage-collected heap
 Manages and executes all threads
simultaneously
JVM Architecture
Class loader loads the Class for
execution
Stores pre-class structure as constant pool
Heap is in which objects are allocated
Local variables and
partial results are
store here. Each
thread has a private
JVM stack created
when the thread is
created
Program
register holds
the address of
JVM instruction
currently being
executed
It contains all
native used
in application
Execution
engine
controls the
execute of
instructions
contained in
the methods
of the classes
Native method interface gives an interface between java
code and native code during execution
Java API [Java Native code
Library]
All java predefined classes are grouped into
physical folders called packages.
java.lang -> basic java programming classes
java.io ->classes for input and output stream
java.net ->networking and socket programming
java.awt -> GUI programming
java.sql -> database programming
javax.swing -> advanced GUI programming , etc
External API’s are also available in form of jar files which can be downloaded and
used as per requirement
Java Runtime Environment [JRE]
 provides the libraries, the Java Virtual Machine,
and other components to run applets and
applications written in the Java programming
language
 JRE does not contain tools and utilities such as
compilers or debuggers for developing applets
and applications
Java Development Kit [JDK]
 The JDK also called Java Development Kit is a
superset of the JRE, and contains everything that
is in the JRE, plus tools such as the compilers
and debuggers necessary for developing applets
and applications
 Tools like
 javac -> java compiler
 java -> java interpreter
 appletviewer -> applet tester, etc
Java Data types
Primitive Non-primitive
 Integer
 byte (1)
 short (2)
 int (4)
 long (8)
 Floating Point
 float (4)
 double (8)
 Character
 char (2)
 Logical
 boolean (1)
 Classes
 Arrays
 Interface
String is a class but is used as a data typ
Typecasting:
allowed for primitive data types only
Programming Components & its
Naming Conventions
 Keywords => lowercase always
 Symbols => single character
 Classes => only alphabets, initial letter of every
word in uppercase
 Methods => only alphabets, initial word in
lowercase & initial letter for rest of the words in
uppercase
 Variable & References => all in lower case
 Constants => all in uppercase
syntax
Java Operators
 Arithmetic
+,-,/,*,%
 Relational
>,<,>=,<=,!=,==
 Logical
&&,||, !
 Increment /
Decrement
++,--
 Bitwise
&,|,^,<<,>>,>>>
 Compound
+=,-=,*=,/=,%=
 Assignment
=
 Special
Ternary, instanceof
Progamming Concepts …..
 Variables & Constants
 Evaluation & creating expression
 Editors & it’s use
 Java program structure
Demonstration follows……
Thank You

More Related Content

Core java introduction

  • 1. Core Java [An Introduction]
  • 2. Presenter Saurav Ghosh Corporate Trainer/Technical Analyst MTA|MCP|MCTS|MCT|Certified Hadoop Developer 11+ Years of Experience in Corporate Training and Application Development
  • 3. Agenda  Getting Started  OOPs & Java as an Object Oriented Language  Brief History  Properties of Java  Java naming conventions  Java API packages  Java data types  Java operators  Installation and configuration  First Java program
  • 4. Procedural vs Object Oriented programming  Use of functions  Called  Independent code  Top - Down approach of programming  Use of methods  Applied  Dependent code  Bottom - Up approach of programming
  • 5. Object Oriented Paradigm[OOP’s]  Data Hiding / Data Abstraction  Encapsulation  Classes & Objects  Inheritance  Dynamic Binding  Polymorphism  Message Passing Object Oriented Programming : is an area / field of OOP’s implementation
  • 6. Object Oriented Language Categories Object Oriented  A program is a file  main() is a function  C++ Object Based  A program is a class or a module or an assembly  main() is a method  Java / .NET / Visual Basic
  • 7. Brief History  Java was developed by James Ghosling, Patrick Naughton, Mike Sheridan at Sun Microsystems Inc. in 1991.  The initial name was Oak but it was renamed to Java in 1995.
  • 8. Versions  Java 1.0 : initial launch  Java 1.1 : redefined AWT event handling, new library elements were added  Java 1.2 : Swing and Collection framework was added  Java 1.3 : No major changes  Java 1.4 : assert keyword added
  • 9. Version 1.5 [J2SE 5]  Generics  Annotations  Autoboxing and Autounboxing  Formatted I/O  For each loop,etc.
  • 10. Java SE 7  Now String can be used to control Switch statement.  Multi Catch Exception  try-with-resource statement  Binary Integer Literals  Underscore in numeric literals, etc.
  • 11. Java SE 8  Lamda Expressions  New Collection Package java.util.stream to provide Stream API.  Enhanced Security  Nashorn Javascript Engine included  Parallel Array Sorting  The JDBC-ODBC Bridge has been removed etc.
  • 12. Properties of Java  Truly / Fully Object Oriented  Compiled and Interpreted  Platform Independent  Robust & Extensible  Automatically garbage collected  Multi threaded programming
  • 13. Applications of Java  Developing Desktop Applications  Web Applications like Linkedin.com, Snapdeal.com etc  Mobile Operating System like Android  Embedded Systems  Robotics and games etc
  • 14. Java Virtual Machine [JVM]  Java virtual Machine(JVM) is a virtual Machine that provides runtime environment to execute java byte code.  JVM control execution of every Java program  It enables features such as automated exception handling, Garbage-collected heap  Manages and executes all threads simultaneously
  • 15. JVM Architecture Class loader loads the Class for execution Stores pre-class structure as constant pool Heap is in which objects are allocated Local variables and partial results are store here. Each thread has a private JVM stack created when the thread is created Program register holds the address of JVM instruction currently being executed It contains all native used in application Execution engine controls the execute of instructions contained in the methods of the classes Native method interface gives an interface between java code and native code during execution
  • 16. Java API [Java Native code Library] All java predefined classes are grouped into physical folders called packages. java.lang -> basic java programming classes java.io ->classes for input and output stream java.net ->networking and socket programming java.awt -> GUI programming java.sql -> database programming javax.swing -> advanced GUI programming , etc External API’s are also available in form of jar files which can be downloaded and used as per requirement
  • 17. Java Runtime Environment [JRE]  provides the libraries, the Java Virtual Machine, and other components to run applets and applications written in the Java programming language  JRE does not contain tools and utilities such as compilers or debuggers for developing applets and applications
  • 18. Java Development Kit [JDK]  The JDK also called Java Development Kit is a superset of the JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications  Tools like  javac -> java compiler  java -> java interpreter  appletviewer -> applet tester, etc
  • 19. Java Data types Primitive Non-primitive  Integer  byte (1)  short (2)  int (4)  long (8)  Floating Point  float (4)  double (8)  Character  char (2)  Logical  boolean (1)  Classes  Arrays  Interface String is a class but is used as a data typ Typecasting: allowed for primitive data types only
  • 20. Programming Components & its Naming Conventions  Keywords => lowercase always  Symbols => single character  Classes => only alphabets, initial letter of every word in uppercase  Methods => only alphabets, initial word in lowercase & initial letter for rest of the words in uppercase  Variable & References => all in lower case  Constants => all in uppercase syntax
  • 21. Java Operators  Arithmetic +,-,/,*,%  Relational >,<,>=,<=,!=,==  Logical &&,||, !  Increment / Decrement ++,--  Bitwise &,|,^,<<,>>,>>>  Compound +=,-=,*=,/=,%=  Assignment =  Special Ternary, instanceof
  • 22. Progamming Concepts …..  Variables & Constants  Evaluation & creating expression  Editors & it’s use  Java program structure