SlideShare a Scribd company logo
Java Basics
Objectives Class Objects Identifiers Methods Encapsulation, inheritance, polymorphism Constructors GC
Class Template State and behaviour of object at run time Abstract class Final class
Interface A 100% abstract class A contact for what a implementing class can do. Behavioural purposes Class can implement multiple interfaces
Variables Primitives Reference Local variables Arrays Final variables Transient
Methods Final Methods Final Arguments Abstract methods Synchronized Native Strictfp Var-args
Encapsulation Keep data protected Keep services open Setters and getters method
Inheritance Re-usability Sometimes we have no implementation  Is-a vs has-a relationship
Polymorphism Overloading Overridding
Constructors Need? Default constructor Constructor overloading Constructor calls in inheritance tree
Static Functions Variables
Memory Management Stack Heap Garbage collector
Exception What are exceptions? Exceptions VS Program Errors Exceptions VS Errors
Exception handling Try catch finally block Catching exception Ducking exception Creating new exceptions Checked / Unchecked exceptions
Time for some practical example A rudimentary banking application Objective: Create some customers and create their saving and current accounts. Display them on the screen. That’s it!
Practical Example 2 Duck simulation game once again? Objective: To show different type of ducks on the screen (Time being each duck can be represented by different text). Some of the ducks can fly / quack while some cannot. Code should first be implemented for Mallard and rubber duck. It should be expandable for other duck type.
Collections – some groundwork toString() method (To be covered later) “ ==“ VS “equals()” == compares references. It’s a bit to bit comparison. However, equals method is overridden by some classes to compares the values of reference variables for ex: String, Integer etc. Example @ Eclipse
Collections – some groundwork 2 When to override equals? For class Car? Color Engine Make 2WD / 4WD VIN
Collections – some groundwork 3 hashCode() Object ID, not necessarily unique, used my HashMap / HashSet etc to store reference to the object. hashCode is used to locate the object in the memory.
Collections – An Introduction What are collections? What do we do with collections? Add objects Remove objects Find an Object Iterate through collection
Collections - continued Key 9 interfaces: Collection, Set, SortedSet List, Map, SortedMap Queue, NavigableSet, NavigableMap
Collections - continued Ordered VS Sorted Mainly used concrete classes: Maps – HashMap, Hashtable, TreeMap, LinkedHashMap Sets – HashSet, LinkedHashSet, TreeSet Lists – ArrayList, Vector, LinkedList Queues – PriorityQueue Utilities – Collections, Arrays
Collections - Sorting Collections.sort  OK – But what about classes – How can we compare them? Comparable Interface – compareTo method Comparator Interface – compare method Examples at Eclipse
Collections - Search Searches are performed using binarySearch() Successful searches return index of element being searched Collection / Array should be sorted to facilitate search If searched element is not there, then the return value of search is = -(index at which if searched element is inserted, sorted order will be maintained) -1. Like a, c, d, e, f if we search for b, return value will be -2 Array / Collection is sorted using comparator, same comparator should be used in search.
Inner Classes A Class can have: Instance variable Methods Classes????  Yes, but what is the use?
Inner Classes – Purpose and Use Chat client example: Normal operation like typing, sending, getting messages from server can be done in ChatClass. But, what about even handling messages? Where should they be? Options are: Same class Other class Inner class
Inner classes - types (Regular) Inner classes Method local Inner classes Anonymous inner classes Static inner classes
Inner Classes Regular Inner Class (Eclipse) Method Inner Class Same as regular inner class with following differences: declared inside method Cannot be instantiated outside method Cannot use method local variables Can not use modifiers like public, private, protected, static
Inner Classes  Anonymous Inner classes - Example at Eclipse Static Nested classes – Example at Eclipse
Threads A thread is a single sequential flow of control within a program.  Multi-threading Types Extending thread class Implementing runnable interface
States of Thread New Runnable Running Waiting/Blocked/Sleeping Dead Waiting / Blocked / Sleeping Dead Running New Runnable
Thread execution JVM & Scheduler Round-robin Time slicing scheduler Thread priorities Sleep Yield Join
Multi-Threading Race condition Preventing race condition Finding atomic operations Make variable private Synchronize the code changing variables
Java I/O I/O Streams Byte Streams  handle I/O of raw binary data.  Character Streams  handle I/O of character data, automatically handling translation to and from the local character set.  Buffered Streams  optimize input and output by reducing the number of calls to the native API.  Scanning and Formatting  allows a program to read and write formatted text.  I/O from the Command Line  describes the Standard Streams and the Console object.  Data Streams  handle binary I/O of primitive data type and String values.  Object Streams  handle binary I/O of objects.  File I/O File Objects  help you to write platform-independent code that examines and manipulates files.  Random Access Files  handle non-sequential file access.
Stream IO Decendents of classes: InputStream OutputStream For example: FileInputStream FileOutputStream
Character IO Wraps byte stream. All character stream classes are descended from  Reader   Writer   For Example: FileReader FileWriter
Buffered IO Buffered Streams: BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Flush()
Scanning and formatting Scanner API Breaks input stream into Tokens Formatting API PrintWriter PrintStream Format method
Command Line IO Standard Streams by: InputStreamReader(System.in) OutputStreamWriter(System.out) Console class: C.readLine() – String C.readPassword – Character[]
Data Streams To read write primitives DataInputStream DataOutputStream
Object IO To read write state of object ObjectInputStream ObjectOutputStream
File Operations Class File Methods: Create file Change file attributes Read / write operation using FileReader / FileWriter of Buffered Readers and writer Delete files Rename files Create directories Class RandomAccessFile Constructor RandomAccessFile(filename, mode); Functions: skipBytes, seek, getFilePointer
Java nio operations Speed IO Block based IO File read: FileInputStream fin = new FileInputStream( &quot;readandshow.txt&quot; ); FileChannel fc = fin.getChannel(); ByteBuffer buffer = ByteBuffer.allocate( 1024 ); fc.read( buffer ); File Write FileOutputStream fout = new FileOutputStream( &quot;writesomebytes.txt&quot; ); FileChannel fc = fout.getChannel(); ByteBuffer buffer = ByteBuffer.allocate( 1024 ); for (int i=0; i<message.length; ++i) { buffer.put( message[i] ); } buffer.flip(); fc.write( buffer );
Serialization Preserving state of object in a file Called serialization or flattening of objects Three ways to do Serialization: using the default protocol customizing the default protocol creating our own protocol
Serialization  using the default protocol You have to implement interface “Serializable” This interface has no methods. So it is just a marker interface. ObjectOutputStream
Serialization using  Customizing the Default Protocol - I What will happen if our class contains objects of some other classes which are not serializable?
Serialization using  Customizing the Default Protocol - II We have to mark those classes as serializable? What if we don’t have access to code of those classes? In case, it is not important to save state of those objects, the way is to mark the variables referring to those objects as transient. But, what if we also want to save state of object.
Serialization using  Customizing the Default Protocol - III So, What should we do to instantiate transient variables? Call our own method after de-serialization? Of course this is a solution. But, what if the other developers does not know about that? What should we do now?
Serialization using  Customizing the Default Protocol - II Provide following two methods in your class: private void writeObject(ObjectOutputStream out) throws IOException;  private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException; Do your operations and then call: defaultWriteObject();  defaultReadObject();  Note that these methods are private. So they are not inhereted, overloaded. In fact, when VM sees that class provides implementation of these methods it call these methods than default methods. Remember, VM can call private methods, any other oject cannot. Also, they can be used to make a call non-serializable even if super class is serializable.
Serialization using  Creating our Own Protocol Instead of implementing the Serializable interface, you can implement Externalizable, which contains two methods:  public void writeExternal(ObjectOutput out) throws IOException;  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;  Just override those methods to provide your own protocol. This protocol is entirely in your hands. An example situation for that alternate type of serialization: read and write PDF files with a Java application. If you know how to write and read PDF (the sequence of bytes required), you could provide the PDF-specific protocol in the writeExternal and readExternal methods.
References Head First Java SCJP Guide – Kethy Sierra Thinking in Java vol.3
Queries
Next Sessions – Servlets and JSP Pre-requisites: Basic knowledge of HTTP - h ttp://en.wikipedia.org/wiki/HTTP Basic Knowledge of HTML – Youtube video -  Basic HTML and CSS Tutorial.  Howto  make website from scratch Introduction to Enterprise applications -  http://www.scribd.com/doc/4052844/1-Introduction-to-Enterprise-Application-Development-wth-JEE Basic Knowledge of J2EE  - Youtube videos -  JEE Introduction   JAVA Enterprise Edition Tutorial   Using the  HttpSession  Object: Servlet and JSP Tutorials J2EE

More Related Content

What's hot (20)

PPT
Java: GUI
Tareq Hasan
 
PPTX
String, string builder, string buffer
SSN College of Engineering, Kalavakkam
 
PPT
Java Collections Framework
Sony India Software Center
 
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
PDF
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
PPT
Inheritance in java
Lovely Professional University
 
PPT
Object-oriented concepts
BG Java EE Course
 
PDF
Basic i/o & file handling in java
JayasankarPR2
 
PDF
Javascript essentials
Bedis ElAchèche
 
PPTX
Java exception handling
BHUVIJAYAVELU
 
PPTX
Inter Thread Communicationn.pptx
SelvakumarNSNS
 
ODP
OOP java
xball977
 
PPTX
Classes objects in java
Madishetty Prathibha
 
PPTX
Core java complete ppt(note)
arvind pandey
 
PPT
Generics in java
suraj pandey
 
PPTX
Arrays in java
Arzath Areeff
 
PPT
Css Ppt
Hema Prasanth
 
PPTX
Recursive Function
Kamal Acharya
 
PPTX
Static keyword ppt
Vinod Kumar
 
Java: GUI
Tareq Hasan
 
String, string builder, string buffer
SSN College of Engineering, Kalavakkam
 
Java Collections Framework
Sony India Software Center
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
Inheritance in java
Lovely Professional University
 
Object-oriented concepts
BG Java EE Course
 
Basic i/o & file handling in java
JayasankarPR2
 
Javascript essentials
Bedis ElAchèche
 
Java exception handling
BHUVIJAYAVELU
 
Inter Thread Communicationn.pptx
SelvakumarNSNS
 
OOP java
xball977
 
Classes objects in java
Madishetty Prathibha
 
Core java complete ppt(note)
arvind pandey
 
Generics in java
suraj pandey
 
Arrays in java
Arzath Areeff
 
Css Ppt
Hema Prasanth
 
Recursive Function
Kamal Acharya
 
Static keyword ppt
Vinod Kumar
 

Viewers also liked (20)

PPT
Java tutorial PPT
Intelligo Technologies
 
PDF
Introduction to Java Programming Language
jaimefrozr
 
PPTX
Introduction to java
Veerabadra Badra
 
PDF
Introduction to Java Programming
Ravi Kant Sahu
 
PPT
Java basic
Sonam Sharma
 
PPT
Java Tutorial
Vijay A Raj
 
PPT
Core java slides
Abhilash Nair
 
PPT
Core java concepts
Ram132
 
PPT
Java tutorial for Beginners and Entry Level
Ramrao Desai
 
PPTX
Basics of sockets
AviNash ChaVhan
 
PPT
Sockets
sivindia
 
PPT
Core Java Basics
mhtspvtltd
 
PPTX
Presentation on Core java
mahir jain
 
PDF
Basic java tutorial
Pedro De Almeida
 
PPTX
Basics of Java
Sherihan Anver
 
PPT
Java inheritance
Arati Gadgil
 
PPT
Networking Java Socket Programming
Mousmi Pawar
 
PDF
02 basic java programming and operators
Danairat Thanabodithammachari
 
PPT
Introduction to-programming
BG Java EE Course
 
PPT
Network programming in Java
Tushar B Kute
 
Java tutorial PPT
Intelligo Technologies
 
Introduction to Java Programming Language
jaimefrozr
 
Introduction to java
Veerabadra Badra
 
Introduction to Java Programming
Ravi Kant Sahu
 
Java basic
Sonam Sharma
 
Java Tutorial
Vijay A Raj
 
Core java slides
Abhilash Nair
 
Core java concepts
Ram132
 
Java tutorial for Beginners and Entry Level
Ramrao Desai
 
Basics of sockets
AviNash ChaVhan
 
Sockets
sivindia
 
Core Java Basics
mhtspvtltd
 
Presentation on Core java
mahir jain
 
Basic java tutorial
Pedro De Almeida
 
Basics of Java
Sherihan Anver
 
Java inheritance
Arati Gadgil
 
Networking Java Socket Programming
Mousmi Pawar
 
02 basic java programming and operators
Danairat Thanabodithammachari
 
Introduction to-programming
BG Java EE Course
 
Network programming in Java
Tushar B Kute
 
Ad

Similar to Java Basics (20)

PPT
Java basics
Jitender Jain
 
PPTX
Input & output
SAIFUR RAHMAN
 
PDF
Java Day-6
People Strategists
 
PDF
Java IO
UTSAB NEUPANE
 
PDF
CSE3146-ADV JAVA M2.pdf
VithalReddy3
 
PPTX
Files io
Narayana Swamy
 
PDF
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
hungvidien123
 
PPTX
Javasession6
Rajeev Kumar
 
PPTX
2CPP17 - File IO
Michael Heron
 
PPTX
CHAPTER 5 mechanical engineeringasaaa.pptx
SadhilAggarwal
 
PPT
Core java
Savita Rawat
 
PDF
Java I/O
Jussi Pohjolainen
 
PPT
Jedi Slides Intro2 Chapter12 Advanced Io Streams
Don Bosco BSIT
 
PPTX
More topics on Java
Ahmed Misbah
 
PDF
Java IO Stream, the introduction to Streams
ranganadh6
 
PPTX
IOStream.pptx
HindAlmisbahi
 
PPTX
14.jun.2012
Tech_MX
 
PDF
Java Wrapper Classes and I/O Mechanisms
Subhadra Sundar Chakraborty
 
PDF
IO Streams, Serialization, de-serialization, autoboxing
Gurpreet singh
 
PPTX
Java I/O
Jayant Dalvi
 
Java basics
Jitender Jain
 
Input & output
SAIFUR RAHMAN
 
Java Day-6
People Strategists
 
Java IO
UTSAB NEUPANE
 
CSE3146-ADV JAVA M2.pdf
VithalReddy3
 
Files io
Narayana Swamy
 
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
hungvidien123
 
Javasession6
Rajeev Kumar
 
2CPP17 - File IO
Michael Heron
 
CHAPTER 5 mechanical engineeringasaaa.pptx
SadhilAggarwal
 
Core java
Savita Rawat
 
Jedi Slides Intro2 Chapter12 Advanced Io Streams
Don Bosco BSIT
 
More topics on Java
Ahmed Misbah
 
Java IO Stream, the introduction to Streams
ranganadh6
 
IOStream.pptx
HindAlmisbahi
 
14.jun.2012
Tech_MX
 
Java Wrapper Classes and I/O Mechanisms
Subhadra Sundar Chakraborty
 
IO Streams, Serialization, de-serialization, autoboxing
Gurpreet singh
 
Java I/O
Jayant Dalvi
 
Ad

Java Basics

  • 2. Objectives Class Objects Identifiers Methods Encapsulation, inheritance, polymorphism Constructors GC
  • 3. Class Template State and behaviour of object at run time Abstract class Final class
  • 4. Interface A 100% abstract class A contact for what a implementing class can do. Behavioural purposes Class can implement multiple interfaces
  • 5. Variables Primitives Reference Local variables Arrays Final variables Transient
  • 6. Methods Final Methods Final Arguments Abstract methods Synchronized Native Strictfp Var-args
  • 7. Encapsulation Keep data protected Keep services open Setters and getters method
  • 8. Inheritance Re-usability Sometimes we have no implementation Is-a vs has-a relationship
  • 10. Constructors Need? Default constructor Constructor overloading Constructor calls in inheritance tree
  • 12. Memory Management Stack Heap Garbage collector
  • 13. Exception What are exceptions? Exceptions VS Program Errors Exceptions VS Errors
  • 14. Exception handling Try catch finally block Catching exception Ducking exception Creating new exceptions Checked / Unchecked exceptions
  • 15. Time for some practical example A rudimentary banking application Objective: Create some customers and create their saving and current accounts. Display them on the screen. That’s it!
  • 16. Practical Example 2 Duck simulation game once again? Objective: To show different type of ducks on the screen (Time being each duck can be represented by different text). Some of the ducks can fly / quack while some cannot. Code should first be implemented for Mallard and rubber duck. It should be expandable for other duck type.
  • 17. Collections – some groundwork toString() method (To be covered later) “ ==“ VS “equals()” == compares references. It’s a bit to bit comparison. However, equals method is overridden by some classes to compares the values of reference variables for ex: String, Integer etc. Example @ Eclipse
  • 18. Collections – some groundwork 2 When to override equals? For class Car? Color Engine Make 2WD / 4WD VIN
  • 19. Collections – some groundwork 3 hashCode() Object ID, not necessarily unique, used my HashMap / HashSet etc to store reference to the object. hashCode is used to locate the object in the memory.
  • 20. Collections – An Introduction What are collections? What do we do with collections? Add objects Remove objects Find an Object Iterate through collection
  • 21. Collections - continued Key 9 interfaces: Collection, Set, SortedSet List, Map, SortedMap Queue, NavigableSet, NavigableMap
  • 22. Collections - continued Ordered VS Sorted Mainly used concrete classes: Maps – HashMap, Hashtable, TreeMap, LinkedHashMap Sets – HashSet, LinkedHashSet, TreeSet Lists – ArrayList, Vector, LinkedList Queues – PriorityQueue Utilities – Collections, Arrays
  • 23. Collections - Sorting Collections.sort OK – But what about classes – How can we compare them? Comparable Interface – compareTo method Comparator Interface – compare method Examples at Eclipse
  • 24. Collections - Search Searches are performed using binarySearch() Successful searches return index of element being searched Collection / Array should be sorted to facilitate search If searched element is not there, then the return value of search is = -(index at which if searched element is inserted, sorted order will be maintained) -1. Like a, c, d, e, f if we search for b, return value will be -2 Array / Collection is sorted using comparator, same comparator should be used in search.
  • 25. Inner Classes A Class can have: Instance variable Methods Classes???? Yes, but what is the use?
  • 26. Inner Classes – Purpose and Use Chat client example: Normal operation like typing, sending, getting messages from server can be done in ChatClass. But, what about even handling messages? Where should they be? Options are: Same class Other class Inner class
  • 27. Inner classes - types (Regular) Inner classes Method local Inner classes Anonymous inner classes Static inner classes
  • 28. Inner Classes Regular Inner Class (Eclipse) Method Inner Class Same as regular inner class with following differences: declared inside method Cannot be instantiated outside method Cannot use method local variables Can not use modifiers like public, private, protected, static
  • 29. Inner Classes Anonymous Inner classes - Example at Eclipse Static Nested classes – Example at Eclipse
  • 30. Threads A thread is a single sequential flow of control within a program. Multi-threading Types Extending thread class Implementing runnable interface
  • 31. States of Thread New Runnable Running Waiting/Blocked/Sleeping Dead Waiting / Blocked / Sleeping Dead Running New Runnable
  • 32. Thread execution JVM & Scheduler Round-robin Time slicing scheduler Thread priorities Sleep Yield Join
  • 33. Multi-Threading Race condition Preventing race condition Finding atomic operations Make variable private Synchronize the code changing variables
  • 34. Java I/O I/O Streams Byte Streams handle I/O of raw binary data. Character Streams handle I/O of character data, automatically handling translation to and from the local character set. Buffered Streams optimize input and output by reducing the number of calls to the native API. Scanning and Formatting allows a program to read and write formatted text. I/O from the Command Line describes the Standard Streams and the Console object. Data Streams handle binary I/O of primitive data type and String values. Object Streams handle binary I/O of objects. File I/O File Objects help you to write platform-independent code that examines and manipulates files. Random Access Files handle non-sequential file access.
  • 35. Stream IO Decendents of classes: InputStream OutputStream For example: FileInputStream FileOutputStream
  • 36. Character IO Wraps byte stream. All character stream classes are descended from Reader Writer For Example: FileReader FileWriter
  • 37. Buffered IO Buffered Streams: BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Flush()
  • 38. Scanning and formatting Scanner API Breaks input stream into Tokens Formatting API PrintWriter PrintStream Format method
  • 39. Command Line IO Standard Streams by: InputStreamReader(System.in) OutputStreamWriter(System.out) Console class: C.readLine() – String C.readPassword – Character[]
  • 40. Data Streams To read write primitives DataInputStream DataOutputStream
  • 41. Object IO To read write state of object ObjectInputStream ObjectOutputStream
  • 42. File Operations Class File Methods: Create file Change file attributes Read / write operation using FileReader / FileWriter of Buffered Readers and writer Delete files Rename files Create directories Class RandomAccessFile Constructor RandomAccessFile(filename, mode); Functions: skipBytes, seek, getFilePointer
  • 43. Java nio operations Speed IO Block based IO File read: FileInputStream fin = new FileInputStream( &quot;readandshow.txt&quot; ); FileChannel fc = fin.getChannel(); ByteBuffer buffer = ByteBuffer.allocate( 1024 ); fc.read( buffer ); File Write FileOutputStream fout = new FileOutputStream( &quot;writesomebytes.txt&quot; ); FileChannel fc = fout.getChannel(); ByteBuffer buffer = ByteBuffer.allocate( 1024 ); for (int i=0; i<message.length; ++i) { buffer.put( message[i] ); } buffer.flip(); fc.write( buffer );
  • 44. Serialization Preserving state of object in a file Called serialization or flattening of objects Three ways to do Serialization: using the default protocol customizing the default protocol creating our own protocol
  • 45. Serialization using the default protocol You have to implement interface “Serializable” This interface has no methods. So it is just a marker interface. ObjectOutputStream
  • 46. Serialization using Customizing the Default Protocol - I What will happen if our class contains objects of some other classes which are not serializable?
  • 47. Serialization using Customizing the Default Protocol - II We have to mark those classes as serializable? What if we don’t have access to code of those classes? In case, it is not important to save state of those objects, the way is to mark the variables referring to those objects as transient. But, what if we also want to save state of object.
  • 48. Serialization using Customizing the Default Protocol - III So, What should we do to instantiate transient variables? Call our own method after de-serialization? Of course this is a solution. But, what if the other developers does not know about that? What should we do now?
  • 49. Serialization using Customizing the Default Protocol - II Provide following two methods in your class: private void writeObject(ObjectOutputStream out) throws IOException; private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException; Do your operations and then call: defaultWriteObject(); defaultReadObject(); Note that these methods are private. So they are not inhereted, overloaded. In fact, when VM sees that class provides implementation of these methods it call these methods than default methods. Remember, VM can call private methods, any other oject cannot. Also, they can be used to make a call non-serializable even if super class is serializable.
  • 50. Serialization using Creating our Own Protocol Instead of implementing the Serializable interface, you can implement Externalizable, which contains two methods: public void writeExternal(ObjectOutput out) throws IOException; public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; Just override those methods to provide your own protocol. This protocol is entirely in your hands. An example situation for that alternate type of serialization: read and write PDF files with a Java application. If you know how to write and read PDF (the sequence of bytes required), you could provide the PDF-specific protocol in the writeExternal and readExternal methods.
  • 51. References Head First Java SCJP Guide – Kethy Sierra Thinking in Java vol.3
  • 53. Next Sessions – Servlets and JSP Pre-requisites: Basic knowledge of HTTP - h ttp://en.wikipedia.org/wiki/HTTP Basic Knowledge of HTML – Youtube video - Basic HTML and CSS Tutorial. Howto make website from scratch Introduction to Enterprise applications - http://www.scribd.com/doc/4052844/1-Introduction-to-Enterprise-Application-Development-wth-JEE Basic Knowledge of J2EE - Youtube videos - JEE Introduction JAVA Enterprise Edition Tutorial Using the HttpSession Object: Servlet and JSP Tutorials J2EE