SlideShare une entreprise Scribd logo
1  sur  170
Learn Java  ,[object Object],www.shareittips.com
OOPS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
OOPS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Structure of Java Compiler class C { @NonNull Object field; C( @NonNull Object p) { field = p; } @NonNull Object get() { return field; } } Source File Class File Comments www.shareittips.com Parser Class File Writer Error Type Checker
History of Java ,[object Object],[object Object],[object Object],www.shareittips.com
Features of JAVA ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Components of Java ,[object Object],[object Object],[object Object],www.shareittips.com
Java Virtual Machine ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
JRE and JVM www.shareittips.com
Purpose of Features of OOPS ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Structure of JAVA Program ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Main method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
CamelCase Convention ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Types of Variable ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Variable Initialization ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Constructor ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Arrays ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Array Declaration and Instantiation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Initializing an Array ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Initializing an Array ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
IS-A  & HAS-A relationship ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
IS-A  & HAS-A relationship ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
IS-A  & HAS-A relationship ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Polymorphism ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Types of Overloading ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Overriding ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
this()  and super() call for constructor ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Example : this() and super() class GParent { int a,b,c; GParent()  { System.out.println("From gparent"); } GParent(int a,int b) { //this(a,b,100); this(); System.out.println("a= "+a+" b = "+ b); } GParent(int a,int b,int c) { this.a=a; this.b=b; this.c=c; System.out.println("a= "+a+" b = "+ b + " c= "  +c); } } www.shareittips.com
Example : this() and super() class Parent extends GParent { int x,y; Parent() { System.out.println("From parent"); } Parent(int x,int y) { super(x,y); this.x=x; this.y = y; System.out.println("x= "+x+" y = "+ y); } } www.shareittips.com
Example : this() and super() class Child extends Parent { Child() { super(23,343); System.out.println("From child"); } } class SuperEx { public static void main(String[] a) { //Parent p = new Parent(12,23); Child d = new Child(); } } www.shareittips.com
instanceof operator ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Static Keyword ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Static Keyword ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Static Variable Example class StatEx { int i=10; static int j = 20; public void normalMethod() { System.out.println("Instance var = " + i++); System.out.println("Static var = " + j++); } public static void main(String arg[]) { StatEx s1 = new StatEx(); StatEx s2 = new StatEx(); s1.normalMethod(); s2.normalMethod(); } } www.shareittips.com
Static Method Example class StatEx { int i=10; static int j = 20; public static void staticMethod() { //System.out.println("Instance var = " + i++); //illegal System.out.println("Static var = " + j++); } public static void main(String arg[]) { staticMethod(); staticMethod(); } } www.shareittips.com
Static Initializer Example class StatEx1 { static int counter; //static initializer static { counter=10; System.out.println("Static block invoked "+counter); } public static void sMethod() { System.out.println("Static method" + counter++); } } www.shareittips.com
Static Initializer Example class StatEx { public static void main(String arg[]) { System.out.println("from main"); StatEx1.sMethod(); StatEx1.sMethod(); } } www.shareittips.com
Final Keyword ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Wrapper Class ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Primitive Data Types and Corresponding Wrapper Classes All the wrapper classes except  Boolean and Character  are subclasses of an abstract class called  Number , whereas  Boolean and Character  are derived directly from the  Object  class. www.shareittips.com Primitive Data Type Wrapper Class Constructor Arguments boolean Boolean boolean or String byte Byte byte or String char Character char short Short short or String int Integer int or String long Long long or String float Float double or float or String double Double double or String
Boxing and Unboxing ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
AutoBoxing and AutoUnboxing ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Methods to Extract the Wrapped Values www.shareittips.com Method Class public boolean booleanValue() Boolean public char charValue() Character public byte byteValue() Byte, Short, Integer, Long, Float, Double public short shortValue() Byte, Short, Integer, Long, Float, Double public int intValue() Byte, Short, Integer, Long, Float, Double public long longValue() Byte, Short, Integer, Long, Float, Double public float floatValue() Byte, Short, Integer, Long, Float, Double public double doubleValue() Byte, Short, Integer, Long, Float, Double
Methods to Convert Strings to Primitive Types www.shareittips.com Wrapper Class Method Signature Method Arguments Boolean static boolean parseBoolean(…) String Character Not available Byte static byte parseByte(…) String, or String and radix Short static short parseShort(..) String, or String and radix Integer static int parseInt(…) String, or String and radix Long static long parseLong(…) String, or String and radix Float static float parseFloat(…) String Double static double parseDouble(…) double or String
Wrapper Conversion methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Object Class ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Abstract Class ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Interface ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
enum ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
enum ,[object Object],[object Object],[object Object],www.shareittips.com
Enum Example1 enum Edge { TOP,BOTTOM,LEFT,RIGHT }; class MyClass { public static void main(String[] a) { Edge e = Edge.TOP; int i = e.ordinal(); System.out.println(e); System.out.println(i); } } www.shareittips.com
Enum Example2 enum Edge { TOP,BOTTOM,LEFT,RIGHT; public static void main(String[] a) { Edge e = Edge.TOP; int i = e.ordinal(); System.out.println(e); System.out.println(i); } } www.shareittips.com
Enum Example3 public enum Day { MONDAY(8,true), TUESDAY(8,true), WEDNESDAY(8,true), THURSDAY(8,true), FRIDAY(8,true), SATURDAY(4,false), SUNDAY(0,false); private int hours; private boolean weekday; www.shareittips.com
Enum Example3 Day(int whours,boolean wday) { hours=whours; wday=weekday; } public int getHours() { return hours; } public boolean isWeekDay() { return weekday; } www.shareittips.com
Enum Example3 public static void showDay(Day d) { if(d.isWeekDay()) { System.out.println(d +" is a weekday and has "+  d.getHours() +" hours working hours"); } else { System.out.println(d +" is a not weekday and has  "+ d.getHours() +" hours working hours"); } } www.shareittips.com
Enum Example3 public static void main(String[] ar) { Day day; day = Day.SUNDAY; showDay(day); } } www.shareittips.com
Inner Class ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Example for Regular InnerClass class MyOuter { int x =7; class MyInner { public void InnerMethod() { System.out.println("x == " + x); } } public void OuterMethod() { MyInner inn = new MyInner(); inn.InnerMethod(); } www.shareittips.com
Example for Regular InnerClass public static void main(String[] a) { MyOuter mo = new MyOuter(); MyOuter.MyInner mi = mo.new MyInner(); mi.InnerMethod(); mo.OuterMethod(); //mi.OuterMethod();  illegal //mo.InnerMethod();  illegal  } } www.shareittips.com
Method-local inner class ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Method-local inner class class MouterClass { int x =10; public void OuterMethod() { final int j=90; class MinnerClass { public void minnerMethod() { System.out.println("Hello ..." + x + j); } } MinnerClass mic = new MinnerClass(); mic.minnerMethod(); } public static void main(String[] a) { MouterClass moc = new MouterClass(); moc.OuterMethod(); } } www.shareittips.com
Static  nested class ,[object Object],[object Object],[object Object],www.shareittips.com
Static  nested class class OuterClass { static int i =10; public void method() { System.out.println("i == " + ++i); } static class InnerClass { public void display() { System.out.println("i == " + i); } } www.shareittips.com
Static  nested class public static void main(String[] a) { OuterClass.InnerClass ic = new  OuterClass.InnerClass(); ic.display(); OuterClass oc = new OuterClass(); oc.method(); } } www.shareittips.com
Anonymous Inner Classes ,[object Object],[object Object],www.shareittips.com
Anonymous Inner Classes import java.awt.*; import java.awt.event.*; class FrameExample  { private Frame f; public FrameExample()  { f = new Frame("Hello .....!"); } public void launchFrame()  { f.setSize(170,170);   f.setBackground(Color.blue);   f.setVisible(true); www.shareittips.com
Anonymous Inner Classes // Add a window listener   f.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent evt) { System.exit(0); } });  //Anonymous Inner Classes    } public static void main(String args[])  { FrameExample f = new FrameExample(); f.launchFrame(); } } www.shareittips.com
Exception Handling ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Exceptions ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Checked Exception ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Unchecked Exception ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
The Exception Class Hierarchy Object Throwable Exception Error RuntimeException Others… Others… Others… www.shareittips.com
Exception-handling mechanism ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
About try-catch-finally ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Example 1 class PrintStack { public static void main(String args[])  { int Num1= 30 , Num2 = 0; try {   int Num3=Num1/Num2; } catch(ArithmeticException obj)  {   System.out.println("Exception"+obj); obj.printStackTrace(); } } } www.shareittips.com
Rules in Exception ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Passing the exception ,[object Object],[object Object],[object Object],www.shareittips.com
Throws clause class UncheckedThrows { public void show() throws ArithmeticException { System.out.println("Hai I am not handled"); } public static void main(String[]  arg) { new UncheckedThrows().show(); } } www.shareittips.com
Method Overriding and Exceptions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
User Defined Exception ,[object Object],[object Object],[object Object],www.shareittips.com
Example 2 import java.io.*; class MyException extends Exception  { MyException() { System.out.println("UserDefined Error occured"); } public String toString() { return "MyException thrown"; } } www.shareittips.com
Example 2 cont… class UserExceptions { public void valid()  { try {   String str1,str2;    BufferedReader br=new BufferedReader(new  InputStreamReader(System.in));  System.out.println("Enter Login id"); str1=br.readLine(); System.out.println("Enter password"); str2=br.readLine(); if(str1.equals(str2)) System.out.println("Hai welcome"); else  throw new MyException(); } www.shareittips.com
Example 2 cont … catch(MyException e) { System.out.println("Sorry U r not  a valid user" + e); valid(); } catch(IOException ioe){} } public static void main(String[] arg) throws IOException { UserExceptions e1=new UserExceptions(); e1.valid(); } } www.shareittips.com
String Class Facts ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Literal Strings  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Literal String Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Immutability ,[object Object],[object Object],[object Object],www.shareittips.com
Advantages Of Immutability ,[object Object],String word1 = "Java"; String word2 = word1;  String word1 = “Java"; String word2 = new String(word1);  word1 OK Less efficient: wastes memory word2 word1 word2 www.shareittips.com “ Java" “ Java" “ Java"
Disadvantages of Immutability ,[object Object],String word = “Java”; char ch = Character.toUpperCase(word.charAt (0)); word =  ch + word.substring (1);  word www.shareittips.com “ java" “ Java"
Empty Strings ,[object Object],[object Object],String word1 = ""; String word2 = new String(); private String errorMsg; errorMsg  is  null Empty strings www.shareittips.com
Copy Constructors ,[object Object],[object Object],String word1 = new String(“Java”); String word2 = new String(word); word1 word2 Copy Constructor: Each variable points to a different copy of the String. String word1 = “Java”; String word2 = word; word1 word2 Assignment: Both variables point to the same String. www.shareittips.com “ Java" “ Java" “ Java"
Other Constructors ,[object Object],[object Object],char[] letters = {‘J’, ‘a’, ‘v’, ‘a’}; String word = new String(letters);//”Java” www.shareittips.com
Methods in String Class ,[object Object],[object Object],[object Object],[object Object],[object Object],television i  k television i www.shareittips.com
Methods in String Clas ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
StringBuffer Class ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Methods in String Buffer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
StringBuilder Class ,[object Object],[object Object],[object Object],www.shareittips.com
Collections ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
The Collections Interfaces ,[object Object],[object Object],[object Object],[object Object],Both a Map object and a Set collection cannot contain duplicates data items. while a List collection can contain duplicates.  www.shareittips.com
The Collections Interfaces ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Collection Classes ,[object Object],[object Object],[object Object],www.shareittips.com
www.shareittips.com
List import java.util.*; class ListExample { public static void main(String[] args) { List list = new ArrayList(); list.add("one"); list.add("second"); list.add("3rd"); list.add(new Integer(4)); list.add(new Float(5.0F)); list.add("second");  // duplicate, is added list.add(new Integer(4));  // duplicate, is added System.out.println(list); } } www.shareittips.com
Set import java.util.*; class SetExample { public static void main(String[] args) { Set set = new HashSet(); set.add("one"); set.add("second"); set.add("3rd"); set.add(new Integer(4)); set.add(new Float(5.0F)); set.add("second");  // duplicate, not added set.add(new Integer(4));  // duplicate, not added System.out.println(set); } } www.shareittips.com
Collection API - Storage ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Set Classes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Map Classes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
www.shareittips.com Class Interface Duplicates Allowed? Ordered/ Sorted  Synchronized ArrayList List Yes Ordered by index Not sorted No LinkedList List Yes Ordered by index Not sorted No Vector List Yes Ordered by index Not sorted Yes HashSet Set No Not ordered Not sorted No LinkedHashSet Set No Ordered by insertion Not sorted No TreeSet Set No Sorted either by natural order or by your comparison rules No
www.shareittips.com Class Interface Duplicates Allowed? Ordered/ Sorted  Synchronized HashMap Map No Not ordered Not sorted No LinkedHashMap Map No Ordered No Hashtable Map No Not ordered Not sorted Yes TreeMap Map No Sorted either by natural order or by your comparison rules No
Collection Advantages and Disadvantages ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Generics ,[object Object],[object Object],www.shareittips.com
Date Class ,[object Object],[object Object],www.shareittips.com
Process and Thread ,[object Object],[object Object],[object Object],www.shareittips.com
Threads ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
MultiThreading and MultiTasking ,[object Object],[object Object],[object Object],www.shareittips.com
Creation of a Thread ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
1st Method: Extending the Thread class ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
2nd method: Threads by implementing Runnable interface ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Thread scheduling ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Threads within a process ,[object Object],[object Object],THREAD STACK THREAD DATA THREAD TEXT SHARED MEMORY www.shareittips.com
Thread States A thread can in one of several possible states: 1.Running Currently running In control of CPU 2.Ready to run Can run but not yet given the chance 3.Resumed Ready to run after being suspended or block 4.Suspended Voluntarily allowed other threads to run 5.Blocked Waiting for some resource or event to occur www.shareittips.com
Thread Priorities Why priorities? Determine which thread receives CPU control and gets to be executed first Definition: –  Integer value ranging from 1 to 10 –  Higher the thread priority -> larger chance of being executed first –  Example: ●  Two threads are ready to run ●  First thread: priority of 5, already running ●  Second thread = priority of 10, comes in while first thread is running www.shareittips.com
Thread Synchronization ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Wait() and  notify() ,[object Object],[object Object],www.shareittips.com
wait() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
notify() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Thread Group ,[object Object],[object Object],www.shareittips.com
Semaphore ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Semaphores ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Semaphore ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Semaphore ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
IOStreams ,[object Object],[object Object],[object Object],Program Device output - stream Program Device input - stream www.shareittips.com
keyboard monitor terminal console standard input stream standardoutput stream Streams How does information travel across? www.shareittips.com MEM CPU HDD
keyboard monitor terminal console standard input stream standardoutput stream file input stream LOAD READ file output stream SAVE WRITE Streams files How does information travel across? www.shareittips.com MEM CPU HDD
IOStreams ,[object Object],[object Object],[object Object],I ‘ M A S T R I N G  Program Device 01101001 Program Device 11101101 00000000 www.shareittips.com
IOStreams ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
www.shareittips.com
Binary vs. TextFiles www.shareittips.com pro con Binary (input &output stream) Efficient in terms of time and space Preinformation about data needed to understand content Text(reader and writer) Human readable, contains redundant information Not efficient
Binary vs. TextFiles ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Serialization ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Serialization ,[object Object],[object Object],[object Object],www.shareittips.com
Serialization basics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Serialization code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Deserialization code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Conditions for serializability ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Object Serialization (cont’d) ,[object Object],[object Object],[object Object],www.shareittips.com
Serialization and primitive types ,[object Object],[object Object],www.shareittips.com
transient  and  static  fields ,[object Object],[object Object],[object Object],www.shareittips.com
JDBC ,[object Object],[object Object],[object Object],www.shareittips.com
JDBC Architecture ,[object Object],[object Object],www.shareittips.com
Steps in JDBC ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Garbage Collector (GC) ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Garbage collection and Performance ,[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Garbage Collection ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Finalize() method   ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Classical Algorithms ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Mark-Sweep ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Annotations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Structure of Java5 Compiler class C { @NonNull Object field; C( @NonNull Object p) { field = p; } @NonNull Object get() { return field; } } Annotation Checker Plugins Error Error Source File Program with annotations Class File www.shareittips.com Parser Annotation Checker Class File Writer Type Checker
Annotation Types ,[object Object],[object Object],[object Object],www.shareittips.com
Marker ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Single-Element ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Full-value or multi-value ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
The Built-In Annotations  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
The Target annotation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Reflection ,[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
Need of Annotation  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.shareittips.com
www.shareittips.com www.bcahub.shareittips.com www.shareittips.com

Contenu connexe

Tendances

Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
Tech_MX
 
Object oriented programming in php
Object oriented programming in phpObject oriented programming in php
Object oriented programming in php
Aashiq Kuchey
 

Tendances (20)

Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
PHP Classes and OOPS Concept
PHP Classes and OOPS ConceptPHP Classes and OOPS Concept
PHP Classes and OOPS Concept
 
Inheritance
InheritanceInheritance
Inheritance
 
encapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingencapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloading
 
Basic Oops concept of PHP
Basic Oops concept of PHPBasic Oops concept of PHP
Basic Oops concept of PHP
 
Java Tut1
Java Tut1Java Tut1
Java Tut1
 
Object oriented programming in php
Object oriented programming in phpObject oriented programming in php
Object oriented programming in php
 
Php Oop
Php OopPhp Oop
Php Oop
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
 
Object oreinted php | OOPs
Object oreinted php | OOPsObject oreinted php | OOPs
Object oreinted php | OOPs
 
Basics of Java
Basics of JavaBasics of Java
Basics of Java
 
Packages and inbuilt classes of java
Packages and inbuilt classes of javaPackages and inbuilt classes of java
Packages and inbuilt classes of java
 
OOPS Characteristics (With Examples in PHP)
OOPS Characteristics (With Examples in PHP)OOPS Characteristics (With Examples in PHP)
OOPS Characteristics (With Examples in PHP)
 
Inheritance in Java
Inheritance in JavaInheritance in Java
Inheritance in Java
 
C# Advanced L07-Design Patterns
C# Advanced L07-Design PatternsC# Advanced L07-Design Patterns
C# Advanced L07-Design Patterns
 
Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)
 
An Introduction to the Jena API
An Introduction to the Jena APIAn Introduction to the Jena API
An Introduction to the Jena API
 
Core Java Programming | Data Type | operator | java Control Flow| Class 2
Core Java Programming | Data Type | operator | java Control Flow| Class 2Core Java Programming | Data Type | operator | java Control Flow| Class 2
Core Java Programming | Data Type | operator | java Control Flow| Class 2
 
Java Unit 2(part 3)
Java Unit 2(part 3)Java Unit 2(part 3)
Java Unit 2(part 3)
 

Similaire à Learn java

Md06 advance class features
Md06 advance class featuresMd06 advance class features
Md06 advance class features
Rakesh Madugula
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
DevMix
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
Guillaume Laforge
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2
Todor Kolev
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2
Todor Kolev
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
Rakesh Madugula
 

Similaire à Learn java (20)

Android Training (Java Review)
Android Training (Java Review)Android Training (Java Review)
Android Training (Java Review)
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
Md06 advance class features
Md06 advance class featuresMd06 advance class features
Md06 advance class features
 
Java mcq
Java mcqJava mcq
Java mcq
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshow
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2
 
ORM JPA
ORM JPAORM JPA
ORM JPA
 
Dependency Injection for PHP
Dependency Injection for PHPDependency Injection for PHP
Dependency Injection for PHP
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
Classes2
Classes2Classes2
Classes2
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Dernier (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Learn java

  • 1.
  • 2.
  • 3.
  • 4. Structure of Java Compiler class C { @NonNull Object field; C( @NonNull Object p) { field = p; } @NonNull Object get() { return field; } } Source File Class File Comments www.shareittips.com Parser Class File Writer Error Type Checker
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. JRE and JVM www.shareittips.com
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. Example : this() and super() class GParent { int a,b,c; GParent() { System.out.println("From gparent"); } GParent(int a,int b) { //this(a,b,100); this(); System.out.println("a= "+a+" b = "+ b); } GParent(int a,int b,int c) { this.a=a; this.b=b; this.c=c; System.out.println("a= "+a+" b = "+ b + " c= " +c); } } www.shareittips.com
  • 31. Example : this() and super() class Parent extends GParent { int x,y; Parent() { System.out.println("From parent"); } Parent(int x,int y) { super(x,y); this.x=x; this.y = y; System.out.println("x= "+x+" y = "+ y); } } www.shareittips.com
  • 32. Example : this() and super() class Child extends Parent { Child() { super(23,343); System.out.println("From child"); } } class SuperEx { public static void main(String[] a) { //Parent p = new Parent(12,23); Child d = new Child(); } } www.shareittips.com
  • 33.
  • 34.
  • 35.
  • 36. Static Variable Example class StatEx { int i=10; static int j = 20; public void normalMethod() { System.out.println("Instance var = " + i++); System.out.println("Static var = " + j++); } public static void main(String arg[]) { StatEx s1 = new StatEx(); StatEx s2 = new StatEx(); s1.normalMethod(); s2.normalMethod(); } } www.shareittips.com
  • 37. Static Method Example class StatEx { int i=10; static int j = 20; public static void staticMethod() { //System.out.println("Instance var = " + i++); //illegal System.out.println("Static var = " + j++); } public static void main(String arg[]) { staticMethod(); staticMethod(); } } www.shareittips.com
  • 38. Static Initializer Example class StatEx1 { static int counter; //static initializer static { counter=10; System.out.println("Static block invoked "+counter); } public static void sMethod() { System.out.println("Static method" + counter++); } } www.shareittips.com
  • 39. Static Initializer Example class StatEx { public static void main(String arg[]) { System.out.println("from main"); StatEx1.sMethod(); StatEx1.sMethod(); } } www.shareittips.com
  • 40.
  • 41.
  • 42. Primitive Data Types and Corresponding Wrapper Classes All the wrapper classes except Boolean and Character are subclasses of an abstract class called Number , whereas Boolean and Character are derived directly from the Object class. www.shareittips.com Primitive Data Type Wrapper Class Constructor Arguments boolean Boolean boolean or String byte Byte byte or String char Character char short Short short or String int Integer int or String long Long long or String float Float double or float or String double Double double or String
  • 43.
  • 44.
  • 45. Methods to Extract the Wrapped Values www.shareittips.com Method Class public boolean booleanValue() Boolean public char charValue() Character public byte byteValue() Byte, Short, Integer, Long, Float, Double public short shortValue() Byte, Short, Integer, Long, Float, Double public int intValue() Byte, Short, Integer, Long, Float, Double public long longValue() Byte, Short, Integer, Long, Float, Double public float floatValue() Byte, Short, Integer, Long, Float, Double public double doubleValue() Byte, Short, Integer, Long, Float, Double
  • 46. Methods to Convert Strings to Primitive Types www.shareittips.com Wrapper Class Method Signature Method Arguments Boolean static boolean parseBoolean(…) String Character Not available Byte static byte parseByte(…) String, or String and radix Short static short parseShort(..) String, or String and radix Integer static int parseInt(…) String, or String and radix Long static long parseLong(…) String, or String and radix Float static float parseFloat(…) String Double static double parseDouble(…) double or String
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53. Enum Example1 enum Edge { TOP,BOTTOM,LEFT,RIGHT }; class MyClass { public static void main(String[] a) { Edge e = Edge.TOP; int i = e.ordinal(); System.out.println(e); System.out.println(i); } } www.shareittips.com
  • 54. Enum Example2 enum Edge { TOP,BOTTOM,LEFT,RIGHT; public static void main(String[] a) { Edge e = Edge.TOP; int i = e.ordinal(); System.out.println(e); System.out.println(i); } } www.shareittips.com
  • 55. Enum Example3 public enum Day { MONDAY(8,true), TUESDAY(8,true), WEDNESDAY(8,true), THURSDAY(8,true), FRIDAY(8,true), SATURDAY(4,false), SUNDAY(0,false); private int hours; private boolean weekday; www.shareittips.com
  • 56. Enum Example3 Day(int whours,boolean wday) { hours=whours; wday=weekday; } public int getHours() { return hours; } public boolean isWeekDay() { return weekday; } www.shareittips.com
  • 57. Enum Example3 public static void showDay(Day d) { if(d.isWeekDay()) { System.out.println(d +" is a weekday and has "+ d.getHours() +" hours working hours"); } else { System.out.println(d +" is a not weekday and has "+ d.getHours() +" hours working hours"); } } www.shareittips.com
  • 58. Enum Example3 public static void main(String[] ar) { Day day; day = Day.SUNDAY; showDay(day); } } www.shareittips.com
  • 59.
  • 60. Example for Regular InnerClass class MyOuter { int x =7; class MyInner { public void InnerMethod() { System.out.println("x == " + x); } } public void OuterMethod() { MyInner inn = new MyInner(); inn.InnerMethod(); } www.shareittips.com
  • 61. Example for Regular InnerClass public static void main(String[] a) { MyOuter mo = new MyOuter(); MyOuter.MyInner mi = mo.new MyInner(); mi.InnerMethod(); mo.OuterMethod(); //mi.OuterMethod(); illegal //mo.InnerMethod(); illegal } } www.shareittips.com
  • 62.
  • 63. Method-local inner class class MouterClass { int x =10; public void OuterMethod() { final int j=90; class MinnerClass { public void minnerMethod() { System.out.println("Hello ..." + x + j); } } MinnerClass mic = new MinnerClass(); mic.minnerMethod(); } public static void main(String[] a) { MouterClass moc = new MouterClass(); moc.OuterMethod(); } } www.shareittips.com
  • 64.
  • 65. Static nested class class OuterClass { static int i =10; public void method() { System.out.println("i == " + ++i); } static class InnerClass { public void display() { System.out.println("i == " + i); } } www.shareittips.com
  • 66. Static nested class public static void main(String[] a) { OuterClass.InnerClass ic = new OuterClass.InnerClass(); ic.display(); OuterClass oc = new OuterClass(); oc.method(); } } www.shareittips.com
  • 67.
  • 68. Anonymous Inner Classes import java.awt.*; import java.awt.event.*; class FrameExample { private Frame f; public FrameExample() { f = new Frame("Hello .....!"); } public void launchFrame() { f.setSize(170,170); f.setBackground(Color.blue); f.setVisible(true); www.shareittips.com
  • 69. Anonymous Inner Classes // Add a window listener f.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent evt) { System.exit(0); } }); //Anonymous Inner Classes } public static void main(String args[]) { FrameExample f = new FrameExample(); f.launchFrame(); } } www.shareittips.com
  • 70.
  • 71.
  • 72.
  • 73.
  • 74. The Exception Class Hierarchy Object Throwable Exception Error RuntimeException Others… Others… Others… www.shareittips.com
  • 75.
  • 76.
  • 77. Example 1 class PrintStack { public static void main(String args[]) { int Num1= 30 , Num2 = 0; try { int Num3=Num1/Num2; } catch(ArithmeticException obj) { System.out.println("Exception"+obj); obj.printStackTrace(); } } } www.shareittips.com
  • 78.
  • 79.
  • 80. Throws clause class UncheckedThrows { public void show() throws ArithmeticException { System.out.println("Hai I am not handled"); } public static void main(String[] arg) { new UncheckedThrows().show(); } } www.shareittips.com
  • 81.
  • 82.
  • 83. Example 2 import java.io.*; class MyException extends Exception { MyException() { System.out.println("UserDefined Error occured"); } public String toString() { return "MyException thrown"; } } www.shareittips.com
  • 84. Example 2 cont… class UserExceptions { public void valid() { try { String str1,str2; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter Login id"); str1=br.readLine(); System.out.println("Enter password"); str2=br.readLine(); if(str1.equals(str2)) System.out.println("Hai welcome"); else throw new MyException(); } www.shareittips.com
  • 85. Example 2 cont … catch(MyException e) { System.out.println("Sorry U r not a valid user" + e); valid(); } catch(IOException ioe){} } public static void main(String[] arg) throws IOException { UserExceptions e1=new UserExceptions(); e1.valid(); } } www.shareittips.com
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 105. List import java.util.*; class ListExample { public static void main(String[] args) { List list = new ArrayList(); list.add("one"); list.add("second"); list.add("3rd"); list.add(new Integer(4)); list.add(new Float(5.0F)); list.add("second"); // duplicate, is added list.add(new Integer(4)); // duplicate, is added System.out.println(list); } } www.shareittips.com
  • 106. Set import java.util.*; class SetExample { public static void main(String[] args) { Set set = new HashSet(); set.add("one"); set.add("second"); set.add("3rd"); set.add(new Integer(4)); set.add(new Float(5.0F)); set.add("second"); // duplicate, not added set.add(new Integer(4)); // duplicate, not added System.out.println(set); } } www.shareittips.com
  • 107.
  • 108.
  • 109.
  • 110. www.shareittips.com Class Interface Duplicates Allowed? Ordered/ Sorted Synchronized ArrayList List Yes Ordered by index Not sorted No LinkedList List Yes Ordered by index Not sorted No Vector List Yes Ordered by index Not sorted Yes HashSet Set No Not ordered Not sorted No LinkedHashSet Set No Ordered by insertion Not sorted No TreeSet Set No Sorted either by natural order or by your comparison rules No
  • 111. www.shareittips.com Class Interface Duplicates Allowed? Ordered/ Sorted Synchronized HashMap Map No Not ordered Not sorted No LinkedHashMap Map No Ordered No Hashtable Map No Not ordered Not sorted Yes TreeMap Map No Sorted either by natural order or by your comparison rules No
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123. Thread States A thread can in one of several possible states: 1.Running Currently running In control of CPU 2.Ready to run Can run but not yet given the chance 3.Resumed Ready to run after being suspended or block 4.Suspended Voluntarily allowed other threads to run 5.Blocked Waiting for some resource or event to occur www.shareittips.com
  • 124. Thread Priorities Why priorities? Determine which thread receives CPU control and gets to be executed first Definition: – Integer value ranging from 1 to 10 – Higher the thread priority -> larger chance of being executed first – Example: ● Two threads are ready to run ● First thread: priority of 5, already running ● Second thread = priority of 10, comes in while first thread is running www.shareittips.com
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135. keyboard monitor terminal console standard input stream standardoutput stream Streams How does information travel across? www.shareittips.com MEM CPU HDD
  • 136. keyboard monitor terminal console standard input stream standardoutput stream file input stream LOAD READ file output stream SAVE WRITE Streams files How does information travel across? www.shareittips.com MEM CPU HDD
  • 137.
  • 138.
  • 140. Binary vs. TextFiles www.shareittips.com pro con Binary (input &output stream) Efficient in terms of time and space Preinformation about data needed to understand content Text(reader and writer) Human readable, contains redundant information Not efficient
  • 141.
  • 142.
  • 143.
  • 144.
  • 145.
  • 146.
  • 147.
  • 148.
  • 149.
  • 150.
  • 151.
  • 152.
  • 153.
  • 154.
  • 155.
  • 156.
  • 157.
  • 158.
  • 159.
  • 160.
  • 161. Structure of Java5 Compiler class C { @NonNull Object field; C( @NonNull Object p) { field = p; } @NonNull Object get() { return field; } } Annotation Checker Plugins Error Error Source File Program with annotations Class File www.shareittips.com Parser Annotation Checker Class File Writer Type Checker
  • 162.
  • 163.
  • 164.
  • 165.
  • 166.
  • 167.
  • 168.
  • 169.