SlideShare a Scribd company logo
1 of 56
Java Tutorial Write Once, Run Anywhere
Java - General ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java - General ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How it works…! Compile-time Environment Compile-time Environment Java Bytecodes move locally or through network Java Source (.java) Java Compiler Java Bytecode (.class ) Runtime System Class Loader Bytecode Verifier Java Class Libraries Operating System Hardware Java Virtual machine Java Interpreter Just in Time Compiler
How it works…! ,[object Object],[object Object],[object Object],[object Object]
Java - Security ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Object-Oriented ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java Advantages ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic Java Syntax
Primitive Types and Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Initialisation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Declarations ,[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],Assignment
Basic Mathematical Operators ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Statements & Blocks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Flow of Control ,[object Object],[object Object],[object Object],[object Object],[object Object]
If – The Conditional Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Relational Operators ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
If… else ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Nested if … else ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
else if ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A Warning… ,[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],[object Object]
The switch Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The  for  loop ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
while loops ,[object Object],[object Object],[object Object],[object Object],[object Object],What is the minimum number of times the loop is executed? What is the maximum number of times?
do {… } while loops ,[object Object],[object Object],[object Object],[object Object],[object Object],What is the minimum number of times the loop is executed? What is the maximum number of times?
Break ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Continue ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Arrays ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],3 6 3 1 6 3 4 1 myArray =   0 1 2 3 4 5 6 7
Declaring Arrays ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Assigning Values ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Iterating Through Arrays ,[object Object],[object Object],[object Object],[object Object]
Arrays of Objects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Declaring the Array ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Java Methods & Classes
Classes ARE Object Definitions ,[object Object],[object Object],[object Object],[object Object],[object Object]
The three principles of OOP ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],car auto- matic manual Super class Subclasses draw() draw()
Simple Class and Method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Method Signatures ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Public/private ,[object Object],[object Object],[object Object],[object Object],[object Object]
Using objects ,[object Object],[object Object],[object Object],[object Object],[object Object]
Constructors ,[object Object],[object Object],[object Object],[object Object],[object Object]
Overloading ,[object Object],[object Object],[object Object],[object Object]
Java Development Kit ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Stream Manipulation
Streams and I/O ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Display File Contents import java.io.*; public class FileToOut1 { public static void main(String args[]) { try  { FileInputStream infile = new FileInputStream("testfile.txt"); byte buffer[] = new byte[50]; int nBytesRead; do  { nBytesRead = infile.read(buffer);   System.out.write(buffer, 0, nBytesRead); } while (nBytesRead == buffer.length); } catch (FileNotFoundException e)  { System.err.println("File not found"); }  catch (IOException e) { System.err.println("Read failed"); } } }
Filters ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Writing data to a file using Filters import java.io.*; public class GenerateData { public static void main(String args[]) { try  { FileOutputStream fos = new FileOutputStream("stuff.dat"); DataOutputStream dos = new DataOutputStream(fos); dos.writeInt(2); dos.writeDouble(2.7182818284590451); dos.writeDouble(3.1415926535); dos.close(); fos.close(); } catch (FileNotFoundException e) {  System.err.println("File not found"); } catch (IOException e) { System.err.println("Read or write failed"); } } }
Reading data from a file using filters import java.io.*; public class ReadData { public static void main(String args[]) { try { FileInputStream fis = new FileInputStream(&quot;stuff.dat&quot;); DataInputStream dis = new DataInputStream(fis); int n = dis.readInt(); System.out.println(n); for( int i = 0; i < n; i++ ) { System.out.println(dis.readDouble()); } dis.close(); fis.close(); } catch (FileNotFoundException e) {  System.err.println(&quot;File not found&quot;); } catch (IOException e) { System.err.println(&quot;Read or write failed&quot;); } } }
Object serialization Write objects to a file, instead of writing primitive types. Use the  ObjectInputStream ,  ObjectOutputStream  classes, the same way that filters are used.
Write an object to a file import java.io.*; import java.util.*; public class WriteDate { public WriteDate () { Date d = new Date(); try { FileOutputStream f = new FileOutputStream(&quot;date.ser&quot;); ObjectOutputStream s = new ObjectOutputStream (f); s.writeObject (d); s.close (); }  catch (IOException e) { e.printStackTrace(); } public static void main (String args[]) { new WriteDate (); } }
Read an object from a file import java.util.*; public class ReadDate { public ReadDate () { Date d = null; ObjectInputStream s = null; try {  FileInputStream f = new FileInputStream (&quot;date.ser&quot;); s = new ObjectInputStream (f); } catch (IOException e) { e.printStackTrace(); } try { d = (Date) s.readObject  (); } catch (ClassNotFoundException e) { e.printStackTrace(); }  catch (InvalidClassException e) { e.printStackTrace(); }  catch (StreamCorruptedException e) { e.printStackTrace(); }  catch (OptionalDataException e) { e.printStackTrace(); }  catch (IOException e) { e.printStackTrace(); } System.out.println (&quot;Date serialized at: &quot;+ d); } public static void main (String args[]) { new ReadDate ();  } }
By superVAR

More Related Content

What's hot

Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)arvind pandey
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For SyntaxPravinYalameli
 
for loop in java
for loop in java for loop in java
for loop in java Majid Ali
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming languageMd.Al-imran Roton
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programmingElizabeth Thomas
 
Introduction to java
Introduction to java Introduction to java
Introduction to java Sandeep Rawat
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statementsSaad Sheikh
 
Genesis and Overview of Java
Genesis and Overview of Java Genesis and Overview of Java
Genesis and Overview of Java Ravi_Kant_Sahu
 
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...Edureka!
 
Introduction to java
Introduction to java Introduction to java
Introduction to java Java Lover
 
Core Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika TutorialsCore Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika TutorialsMahika Tutorials
 
Constructor overloading & method overloading
Constructor overloading & method overloadingConstructor overloading & method overloading
Constructor overloading & method overloadinggarishma bhatia
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java ProgrammingMath-Circle
 

What's hot (20)

Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
Introduction of java
Introduction  of javaIntroduction  of java
Introduction of java
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
 
for loop in java
for loop in java for loop in java
for loop in java
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
Java ppt
Java pptJava ppt
Java ppt
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programming
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
 
Genesis and Overview of Java
Genesis and Overview of Java Genesis and Overview of Java
Genesis and Overview of Java
 
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
 
Introduction to java
Introduction to java Introduction to java
Introduction to java
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Core Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika TutorialsCore Java Tutorials by Mahika Tutorials
Core Java Tutorials by Mahika Tutorials
 
Constructor overloading & method overloading
Constructor overloading & method overloadingConstructor overloading & method overloading
Constructor overloading & method overloading
 
Features of java
Features of javaFeatures of java
Features of java
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
java Features
java Featuresjava Features
java Features
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
 

Viewers also liked

Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Languagejaimefrozr
 
Java Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and TuningJava Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and TuningCarol McDonald
 
OOM m'a tuer - Devoxx France 2012
OOM m'a tuer - Devoxx France 2012OOM m'a tuer - Devoxx France 2012
OOM m'a tuer - Devoxx France 2012ekino
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java ProgrammingRavi Kant Sahu
 
Core java concepts
Core java  conceptsCore java  concepts
Core java conceptsRam132
 
Java tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelJava tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelRamrao Desai
 
Core Java Slides
Core Java SlidesCore Java Slides
Core Java SlidesVinit Vyas
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overviewJong Soon Bok
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Javabackdoor
 
Introduction to class in java
Introduction to class in javaIntroduction to class in java
Introduction to class in javakamal kotecha
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaCPD INDIA
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 

Viewers also liked (20)

Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
 
Java Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and TuningJava Garbage Collection, Monitoring, and Tuning
Java Garbage Collection, Monitoring, and Tuning
 
OOM m'a tuer - Devoxx France 2012
OOM m'a tuer - Devoxx France 2012OOM m'a tuer - Devoxx France 2012
OOM m'a tuer - Devoxx France 2012
 
Java basic
Java basicJava basic
Java basic
 
Java programming course for beginners
Java programming course for beginnersJava programming course for beginners
Java programming course for beginners
 
Core java slides
Core java slidesCore java slides
Core java slides
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Core java concepts
Core java  conceptsCore java  concepts
Core java concepts
 
Basic java tutorial
Basic java tutorialBasic java tutorial
Basic java tutorial
 
Java tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelJava tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry Level
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Java features
Java featuresJava features
Java features
 
Core Java Slides
Core Java SlidesCore Java Slides
Core Java Slides
 
Chapter 1. java programming language overview
Chapter 1. java programming language overviewChapter 1. java programming language overview
Chapter 1. java programming language overview
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 
Introduction to class in java
Introduction to class in javaIntroduction to class in java
Introduction to class in java
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Java features
Java featuresJava features
Java features
 

Similar to Java Tutorial

Similar to Java Tutorial (20)

Java tutorial PPT
Java tutorial  PPTJava tutorial  PPT
Java tutorial PPT
 
Java tutorials
Java tutorialsJava tutorials
Java tutorials
 
Java tut1
Java tut1Java tut1
Java tut1
 
Java tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo CahersiveenJava tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo Cahersiveen
 
Javatut1
Javatut1 Javatut1
Javatut1
 
Java tut1
Java tut1Java tut1
Java tut1
 
Java Tutorial
Java TutorialJava Tutorial
Java Tutorial
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.
 
Java Tutorial | My Heart
Java Tutorial | My HeartJava Tutorial | My Heart
Java Tutorial | My Heart
 
Java basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaJava basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini india
 
Java basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini indiaJava basic tutorial by sanjeevini india
Java basic tutorial by sanjeevini india
 
Java Tutorial
Java Tutorial Java Tutorial
Java Tutorial
 
Unit I Advanced Java Programming Course
Unit I   Advanced Java Programming CourseUnit I   Advanced Java Programming Course
Unit I Advanced Java Programming Course
 
Learning Java 1 – Introduction
Learning Java 1 – IntroductionLearning Java 1 – Introduction
Learning Java 1 – Introduction
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
Java if and else
Java if and elseJava if and else
Java if and else
 
JAVA LOOP.pptx
JAVA LOOP.pptxJAVA LOOP.pptx
JAVA LOOP.pptx
 
00_Introduction to Java.ppt
00_Introduction to Java.ppt00_Introduction to Java.ppt
00_Introduction to Java.ppt
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptLecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops concept
 

More from Vijay A Raj

The Nervous System
The Nervous SystemThe Nervous System
The Nervous SystemVijay A Raj
 
Determinants Of Demand
Determinants Of DemandDeterminants Of Demand
Determinants Of DemandVijay A Raj
 
General Tips To Overcome An Interview
General Tips To Overcome An InterviewGeneral Tips To Overcome An Interview
General Tips To Overcome An InterviewVijay A Raj
 
Transactional & Transformational Leadership
Transactional & Transformational LeadershipTransactional & Transformational Leadership
Transactional & Transformational LeadershipVijay A Raj
 
Michal Jackson Dies
Michal Jackson DiesMichal Jackson Dies
Michal Jackson DiesVijay A Raj
 

More from Vijay A Raj (13)

The Nervous System
The Nervous SystemThe Nervous System
The Nervous System
 
Global Warming
Global WarmingGlobal Warming
Global Warming
 
Robotic
RoboticRobotic
Robotic
 
Determinants Of Demand
Determinants Of DemandDeterminants Of Demand
Determinants Of Demand
 
Gliese 581D
Gliese 581DGliese 581D
Gliese 581D
 
Java Intro
Java IntroJava Intro
Java Intro
 
General Tips To Overcome An Interview
General Tips To Overcome An InterviewGeneral Tips To Overcome An Interview
General Tips To Overcome An Interview
 
Transactional & Transformational Leadership
Transactional & Transformational LeadershipTransactional & Transformational Leadership
Transactional & Transformational Leadership
 
Leader
LeaderLeader
Leader
 
LeaderShip
LeaderShipLeaderShip
LeaderShip
 
LeaderShip
LeaderShipLeaderShip
LeaderShip
 
Michal Jackson Dies
Michal Jackson DiesMichal Jackson Dies
Michal Jackson Dies
 
35 Xl Tips
35 Xl Tips35 Xl Tips
35 Xl Tips
 

Recently uploaded

USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 

Recently uploaded (20)

USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 

Java Tutorial

  • 1. Java Tutorial Write Once, Run Anywhere
  • 2.
  • 3.
  • 4. How it works…! Compile-time Environment Compile-time Environment Java Bytecodes move locally or through network Java Source (.java) Java Compiler Java Bytecode (.class ) Runtime System Class Loader Bytecode Verifier Java Class Libraries Operating System Hardware Java Virtual machine Java Interpreter Just in Time Compiler
  • 5.
  • 6.
  • 7.
  • 8.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. Java Methods & Classes
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 48.
  • 49. Display File Contents import java.io.*; public class FileToOut1 { public static void main(String args[]) { try { FileInputStream infile = new FileInputStream(&quot;testfile.txt&quot;); byte buffer[] = new byte[50]; int nBytesRead; do { nBytesRead = infile.read(buffer); System.out.write(buffer, 0, nBytesRead); } while (nBytesRead == buffer.length); } catch (FileNotFoundException e) { System.err.println(&quot;File not found&quot;); } catch (IOException e) { System.err.println(&quot;Read failed&quot;); } } }
  • 50.
  • 51. Writing data to a file using Filters import java.io.*; public class GenerateData { public static void main(String args[]) { try { FileOutputStream fos = new FileOutputStream(&quot;stuff.dat&quot;); DataOutputStream dos = new DataOutputStream(fos); dos.writeInt(2); dos.writeDouble(2.7182818284590451); dos.writeDouble(3.1415926535); dos.close(); fos.close(); } catch (FileNotFoundException e) { System.err.println(&quot;File not found&quot;); } catch (IOException e) { System.err.println(&quot;Read or write failed&quot;); } } }
  • 52. Reading data from a file using filters import java.io.*; public class ReadData { public static void main(String args[]) { try { FileInputStream fis = new FileInputStream(&quot;stuff.dat&quot;); DataInputStream dis = new DataInputStream(fis); int n = dis.readInt(); System.out.println(n); for( int i = 0; i < n; i++ ) { System.out.println(dis.readDouble()); } dis.close(); fis.close(); } catch (FileNotFoundException e) { System.err.println(&quot;File not found&quot;); } catch (IOException e) { System.err.println(&quot;Read or write failed&quot;); } } }
  • 53. Object serialization Write objects to a file, instead of writing primitive types. Use the ObjectInputStream , ObjectOutputStream classes, the same way that filters are used.
  • 54. Write an object to a file import java.io.*; import java.util.*; public class WriteDate { public WriteDate () { Date d = new Date(); try { FileOutputStream f = new FileOutputStream(&quot;date.ser&quot;); ObjectOutputStream s = new ObjectOutputStream (f); s.writeObject (d); s.close (); } catch (IOException e) { e.printStackTrace(); } public static void main (String args[]) { new WriteDate (); } }
  • 55. Read an object from a file import java.util.*; public class ReadDate { public ReadDate () { Date d = null; ObjectInputStream s = null; try { FileInputStream f = new FileInputStream (&quot;date.ser&quot;); s = new ObjectInputStream (f); } catch (IOException e) { e.printStackTrace(); } try { d = (Date) s.readObject (); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InvalidClassException e) { e.printStackTrace(); } catch (StreamCorruptedException e) { e.printStackTrace(); } catch (OptionalDataException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println (&quot;Date serialized at: &quot;+ d); } public static void main (String args[]) { new ReadDate (); } }