SlideShare a Scribd company logo
1 of 22
Download to read offline
Java Essentials for Hadoop
Agenda
What is Java ?
Features of Java
How Java Works
Java Data Types
Java Operators
Statements & Blocks in Java
Java Class
Java Basic Constructs
Creating an Object
Arrays
What is Java ?
Java is a high level programming language
developed by Sun Microsystems and
released in November 1995.
Java can be used to create complete
applications that may run on a single
computer or be distributed among servers
and clients in a network.
Java is Object-Oriented and follows the
principal of “write once run anywhere”
codes.
Features of Java
Simple
Object Oriented
Multithreaded
Distributed
Platform Independent
Secure
Robust
What is JDK and JRE ?
JDK
+
Development
tools
 Compiler
 Debugger
JRE
JVM
Utility
Classes
How Java Works ?
Source
Code
Byte
Code
JVM
JIT Compiler
Java
Interpreter
Runtime
System
Output of
the
program
Java Compiler
Hexadecimal format
It is used to speed up the execution
Converts total byte code
into machine code
Data Types
Data Type Size Default value
Boolean 1 bit False
char 2 bytes 'u0000'
byte 1 byte 0
short 2 bytes 0
int 4 bytes 0
long 8 bytes 0L
float 4 bytes 0.0f
double 8 bytes 0.0d
String(any object) - null
Primitive Data Types
Non-primitive Data Types
(Reference type)
1. Class Type
2. Interface Type
3. Array type
Operators
Provide a way to perform different operations on variables.
Operator Type operators
Assignment =
Arithmetic + , - , * , /
Relational < , > , <= , >= , == , !=
Logical && , || , !
Bitwise &, |, ^, >>, <<
Unary ++ , --, +, -, !
Statements & Blocks in JAVA
Statements are always terminated by
a semi-colon(;)
A block is a compound
statement enclosed in curly
brackets.
Statement forms a complete
command to be executed.
class Stat
{
Boolean flag ; //statement 1
Int x = 20 ; //Statement 2
.
.
}
Open braces for a block
End of block, using close braces
A class can be defined as a template/blue print that describes the
behaviors and states that object of its type support.
Objects have states and behaviors.
Example: Bicycles have state (current gear, current pedal cadence, two wheels,
number of gears) and behavior (braking, accelerating, slowing down, changing gears).
An object is an instance of a class.
Java Class
Example of a class
public class hello {
public static void main(String[] args)
{
int number = 10; //variable
System.out.println("Hello");
System.out.println(number);
}
}
class Myclass
{
//data members
//constructors
// methods or member functions
}
Method
Public static void myFunction(arg1, arg2, arg3)
{
}
Modifier
Java keyword
return type
function name
Any number of
arguments
//Body of the method
Public
• Can be accessed from anywhere.
Protected
• Can be accessed in the same package or any derived
class.
Default
• Can be accessed within the class only.
Private
• Can be accessed within the same package.
Modifiers
Java Basic Constructs
If…else case
Switch Case
Loops in Java – for loop, while loop,
do while loop
If Else - Syntax
If (condition)
{
Statements
}
else
{
Statements
}
Statements
true
false
condition
Switch - Syntax
Switch(x)
{
Case 1:
Statements
Case 2:
Statements
default :
Statements
}
Case 1
Statements
Statements
Case 2
true
false
true
false
default
End of the switch
Statement
For Loop - Syntax
for (initialization;
condition;
increment/decrement;)
{
statement 1;
statement 2;
…
}
Initialization
Inside the for loop
true
false
Increment/
decrement
End of for loop
condition
While Loop - Syntax
while (<condition>)
{
statement1;
…
}
Initialization
Inside the for loop
true
false
Increment/
decrement
End of for loop
condition
Do While Loop Syntax
do
{
statement 1;
statement 2;
……
} while (<condition>) ;
Initialization
Inside the do while loop
true
false
Increment/
decrement
End of for loop
condition
condition
Creation of the Object
Class_name object_name = new class_name();
Name of the class
Creates a reference object
Allocate memory
Constructor of the class
Creates a new object
An array is a list of similar elements.
An array has a fixed:
- name
- type
- length
These must be declared when the array is created.
Array size cannot be changed during the execution
of the code.
Arrays
Java essentials for hadoop

More Related Content

What's hot

Lecture - 1 introduction to java
Lecture - 1 introduction to javaLecture - 1 introduction to java
Lecture - 1 introduction to javamanish kumar
 
Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in javaagorolabs
 
Java 101 Intro to Java Programming
Java 101 Intro to Java ProgrammingJava 101 Intro to Java Programming
Java 101 Intro to Java Programmingagorolabs
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java ProgrammingMath-Circle
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Javabackdoor
 
Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Kernel Training
 
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...Jorge Hidalgo
 
Unit3 part3-packages and interfaces
Unit3 part3-packages and interfacesUnit3 part3-packages and interfaces
Unit3 part3-packages and interfacesDevaKumari Vijay
 
Basics of java programming language
Basics of java programming languageBasics of java programming language
Basics of java programming languagemasud33bd
 
Local variables Instance variables Class/static variables
Local variables Instance variables Class/static variablesLocal variables Instance variables Class/static variables
Local variables Instance variables Class/static variablesSohanur63
 

What's hot (19)

Lecture - 1 introduction to java
Lecture - 1 introduction to javaLecture - 1 introduction to java
Lecture - 1 introduction to java
 
Java static keyword
Java static keywordJava static keyword
Java static keyword
 
Core java
Core javaCore java
Core java
 
Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in java
 
Java 101 Intro to Java Programming
Java 101 Intro to Java ProgrammingJava 101 Intro to Java Programming
Java 101 Intro to Java Programming
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
 
6. static keyword
6. static keyword6. static keyword
6. static keyword
 
Java keywords
Java keywordsJava keywords
Java keywords
 
Java static keyword
Java static keywordJava static keyword
Java static keyword
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 
Java basic
Java basicJava basic
Java basic
 
Core Java introduction | Basics | free course
Core Java introduction | Basics | free course Core Java introduction | Basics | free course
Core Java introduction | Basics | free course
 
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
 
Core java
Core java Core java
Core java
 
Unit3 part3-packages and interfaces
Unit3 part3-packages and interfacesUnit3 part3-packages and interfaces
Unit3 part3-packages and interfaces
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
Basics of java programming language
Basics of java programming languageBasics of java programming language
Basics of java programming language
 
Local variables Instance variables Class/static variables
Local variables Instance variables Class/static variablesLocal variables Instance variables Class/static variables
Local variables Instance variables Class/static variables
 
Basics of Java
Basics of JavaBasics of Java
Basics of Java
 

Similar to Java essentials for hadoop

Introduction to java
Introduction to javaIntroduction to java
Introduction to javaSujit Majety
 
Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdprat0ham
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruNithin Kumar,VVCE, Mysuru
 
Java-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oopsJava-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oopsbuvanabala
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel Fomitescu
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedyearninginjava
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedGaurav Maheshwari
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfUmesh Kumar
 
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsAashish Jain
 

Similar to Java essentials for hadoop (20)

Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Introduction java programming
Introduction java programmingIntroduction java programming
Introduction java programming
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
 
Module 1.pptx
Module 1.pptxModule 1.pptx
Module 1.pptx
 
DAY_1.1.pptx
DAY_1.1.pptxDAY_1.1.pptx
DAY_1.1.pptx
 
Basic java part_ii
Basic java part_iiBasic java part_ii
Basic java part_ii
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 
Java-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oopsJava-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oops
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016Manuel - SPR - Intro to Java Language_2016
Manuel - SPR - Intro to Java Language_2016
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experienced
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experienced
 
Java basic concept
Java basic conceptJava basic concept
Java basic concept
 
Java presentation
Java presentation Java presentation
Java presentation
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic Concepts
 

More from KCC Software Ltd. & Easylearning.guru (11)

Mba
MbaMba
Mba
 
Python GUI Course Summary - 7 Modules
Python GUI Course Summary - 7 ModulesPython GUI Course Summary - 7 Modules
Python GUI Course Summary - 7 Modules
 
Prerequisites of Bootstrap
Prerequisites of BootstrapPrerequisites of Bootstrap
Prerequisites of Bootstrap
 
Bootstrap Self-paced Cousre Syllabus
Bootstrap Self-paced Cousre SyllabusBootstrap Self-paced Cousre Syllabus
Bootstrap Self-paced Cousre Syllabus
 
10 Keynotes in STRATA and HADOOP World Conference
10 Keynotes in STRATA and HADOOP World Conference10 Keynotes in STRATA and HADOOP World Conference
10 Keynotes in STRATA and HADOOP World Conference
 
Mongodb tutorial at Easylearning Guru
Mongodb tutorial  at Easylearning GuruMongodb tutorial  at Easylearning Guru
Mongodb tutorial at Easylearning Guru
 
Online MongoDB Training by Easylearning.guru
Online MongoDB Training by Easylearning.guruOnline MongoDB Training by Easylearning.guru
Online MongoDB Training by Easylearning.guru
 
Big Data Hadoop Tutorial by Easylearning Guru
Big Data Hadoop Tutorial by Easylearning GuruBig Data Hadoop Tutorial by Easylearning Guru
Big Data Hadoop Tutorial by Easylearning Guru
 
Big Data Hadoop Training by Easylearning Guru
Big Data Hadoop Training by Easylearning GuruBig Data Hadoop Training by Easylearning Guru
Big Data Hadoop Training by Easylearning Guru
 
Python Online From EasyLearning Guru
Python Online From EasyLearning GuruPython Online From EasyLearning Guru
Python Online From EasyLearning Guru
 
Easylearning Guru online Hadoop class
Easylearning Guru online Hadoop class Easylearning Guru online Hadoop class
Easylearning Guru online Hadoop class
 

Recently uploaded

Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
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
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 

Recently uploaded (20)

Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
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
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
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
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 

Java essentials for hadoop

  • 2. Agenda What is Java ? Features of Java How Java Works Java Data Types Java Operators Statements & Blocks in Java Java Class Java Basic Constructs Creating an Object Arrays
  • 3. What is Java ? Java is a high level programming language developed by Sun Microsystems and released in November 1995. Java can be used to create complete applications that may run on a single computer or be distributed among servers and clients in a network. Java is Object-Oriented and follows the principal of “write once run anywhere” codes.
  • 4. Features of Java Simple Object Oriented Multithreaded Distributed Platform Independent Secure Robust
  • 5. What is JDK and JRE ? JDK + Development tools  Compiler  Debugger JRE JVM Utility Classes
  • 6. How Java Works ? Source Code Byte Code JVM JIT Compiler Java Interpreter Runtime System Output of the program Java Compiler Hexadecimal format It is used to speed up the execution Converts total byte code into machine code
  • 7. Data Types Data Type Size Default value Boolean 1 bit False char 2 bytes 'u0000' byte 1 byte 0 short 2 bytes 0 int 4 bytes 0 long 8 bytes 0L float 4 bytes 0.0f double 8 bytes 0.0d String(any object) - null Primitive Data Types Non-primitive Data Types (Reference type) 1. Class Type 2. Interface Type 3. Array type
  • 8. Operators Provide a way to perform different operations on variables. Operator Type operators Assignment = Arithmetic + , - , * , / Relational < , > , <= , >= , == , != Logical && , || , ! Bitwise &, |, ^, >>, << Unary ++ , --, +, -, !
  • 9. Statements & Blocks in JAVA Statements are always terminated by a semi-colon(;) A block is a compound statement enclosed in curly brackets. Statement forms a complete command to be executed. class Stat { Boolean flag ; //statement 1 Int x = 20 ; //Statement 2 . . } Open braces for a block End of block, using close braces
  • 10. A class can be defined as a template/blue print that describes the behaviors and states that object of its type support. Objects have states and behaviors. Example: Bicycles have state (current gear, current pedal cadence, two wheels, number of gears) and behavior (braking, accelerating, slowing down, changing gears). An object is an instance of a class. Java Class
  • 11. Example of a class public class hello { public static void main(String[] args) { int number = 10; //variable System.out.println("Hello"); System.out.println(number); } } class Myclass { //data members //constructors // methods or member functions }
  • 12. Method Public static void myFunction(arg1, arg2, arg3) { } Modifier Java keyword return type function name Any number of arguments //Body of the method
  • 13. Public • Can be accessed from anywhere. Protected • Can be accessed in the same package or any derived class. Default • Can be accessed within the class only. Private • Can be accessed within the same package. Modifiers
  • 14. Java Basic Constructs If…else case Switch Case Loops in Java – for loop, while loop, do while loop
  • 15. If Else - Syntax If (condition) { Statements } else { Statements } Statements true false condition
  • 16. Switch - Syntax Switch(x) { Case 1: Statements Case 2: Statements default : Statements } Case 1 Statements Statements Case 2 true false true false default End of the switch Statement
  • 17. For Loop - Syntax for (initialization; condition; increment/decrement;) { statement 1; statement 2; … } Initialization Inside the for loop true false Increment/ decrement End of for loop condition
  • 18. While Loop - Syntax while (<condition>) { statement1; … } Initialization Inside the for loop true false Increment/ decrement End of for loop condition
  • 19. Do While Loop Syntax do { statement 1; statement 2; …… } while (<condition>) ; Initialization Inside the do while loop true false Increment/ decrement End of for loop condition condition
  • 20. Creation of the Object Class_name object_name = new class_name(); Name of the class Creates a reference object Allocate memory Constructor of the class Creates a new object
  • 21. An array is a list of similar elements. An array has a fixed: - name - type - length These must be declared when the array is created. Array size cannot be changed during the execution of the code. Arrays