SlideShare a Scribd company logo
Java Review
(Essentials of Java for Hadoop)
Have You Joined Our
LinkedIn Group?
What is Java ?
• Java
- Java is not just a programming language but it is a complete
platform for object oriented programming.
• JRE
- Java standard class libraries which provide Application
Programming Interface and JVM together form JRE (Java Runtime
Environment).
• JDK
- JDK (Java development kit) provides all the needed support for
software development in Java.
Java Virtual Machine (JVM)
• Runs the Byte Code.
• Makes Java platform independent.
• Handles Memory Management.
How Java works ?
• Java compilers convert your code from human readable to
so ethi g alled bytecode i the Ja a orld.
• Bytecode is i terpreted y a JVM, which operates much
like a physical CPU to actually execute the compiled code.
• Just-in-time (JIT) compiler is a program that turns
Java bytecode into instructions that can be sent directly to
the processor.
How Java works ?
Basic Java Syntax
Data Types in Java
• Data types define the nature of a value
• We need different data-types to handle real-world information
Name Size (in bits) Range
long 64 -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
int 32 –2,147,483,648 to 2,147,483,647
Short 16 –32,768 to 32,767
byte 8 –128 to 127
double 64 4.9e–324 to 1.8e+308
float 32 1.4e–045 to 3.4e+038
char 16 0 to 65,536
boolean ??
true/false
Naming Convention of Variables
• Can start with a letter, an underscore(_), or a dollar sign ($)
• Cannot start with a number.
 long _LongNumber = 9999999;
 String firstName = Joh ;
 float $Val = 2.3f;
 int i, index = 2;
 double gamma = 1.2;
 boolean value2 = false;
Operators
• Provide a way to perform different operations on
variables
• Categories of Java Operators
Assignment Operators =
Arithmetic Operators - + * / %
Relational Operators > < >= <= == !=
Logical Operators && || & | ^
Unary Operators + - ++ -- !
Assignment and Arithmetic Operators
• Used to assign a value to a variable
• Syntax
– <variable> = <expression>
• Java provides eight Arithmetic operators:
– for addition, subtraction, multiplication, division, modulo (or
remainder), increment (or add 1), decrement (or subtract 1),
and negation.
Assignment Operator =
Relational Operators
• Used to compare two values.
• Binary operators, and their operands are numeric
expressions.
Relational Operators > < >= <= == !=
Logical Operators
• Return a true or false value based on the state of
the variables
• There are six logical operators
Conditional AND Conditional OR AND OR NOT Exclusive OR
Logical Operators && || & | ! ^
Static versus Non-static Variables
• Static variables are shared across all the objects of a
class
– There is only one copy
• Non-Static variables are not shared
– There is a separate copy for each individual live object.
• Static variables cannot be declared within a
method.
Statements & Blocks
• A simple statement is a command terminated by a semi-colon:
a e = Fred ;
• A block is a compound statement enclosed in curly brackets:
{
a e = Fred ; a e = Bill ;
}
• Blocks may contain other blocks.
Flow of Control
• Java executes one statement after the other in the
order they are written.
• Many Java statements are flow control statements:
Alternation:
if, if else, switch
Looping:
for, while, do while
Java Basic Constructs
• If…else
• Switch Statement
• For Loop
• While Loop
• Do...While Loop
If else– Syntax
if ( <condition> )
{
// Execute these statements if <condition> is TRUE
}
else
{
// Execute these statements if < condition> is FALSE
}
switch– Syntax
switch (expression)
{
case cond1:
block_1;
break;
case cond2:
block_2;
break;
...
default:
block_default;
}
For– Syntax
for (initialization; condition; increment/decrement)
{
statement 1;
statement 2; . .
}
Sample:
for( int i=0; i<5; i++ )
{
System.out.println(i);
}
For loop - Working
For(int i=0; i<5; i++){
Statement 1;
Statement 2;
}
While – Syntax
while (condition)
{
statement 1;
statement 2; . .
}
Sample:
int i=0;
while (i<5)
{
System.out.println(i);
i++;
}
While Loop - Working
int i=0;
while(i < 5){
Statement 1;
Statement 2;
i++;
}
Do While – Syntax
do
{
statement 1;
statement 2; . .
} while (condition) ;
Sample:
int i=0;
do
{
System.out.println(i);
i++;
} while (i<5);
Do While Loop - Working
int i=0;
do{
Statement 1;
Statement 2;
i++;
} while(i < 5)
Arrays
• An array is a list of similar things.
• 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.
Example of an Array
int array [] = new int[5];
for(int i=0; i<5 ; i++)
{
array[i] = i+1;
}
1
2
3
4
5
array[0]
array[1]
array[2]
array[3]
array[4]
Java Methods & Classes
An Example class
package com.edureka.entity; // package
public class Car{ //class declaration
String name;
String color;
float weight;
...
public void move(){ //
method
...
}
}
Methods
• A method is a named sequence of code that can be
invoked by other Java code.
• A method takes some parameters, performs some
computations and then optionally returns a value (or
object).
Ex:
public float convert_to _Celsius( float temp) {
return(((temp * 9.0f) / 5.0f) + 32.0f );
}
return_type method_name (arg1, arg2, arg3)
{
____
____
}
Methods
Methods have five components:
• Modifiers
• The return type
• The method name
• The parameter list in parenthesis
• The method body, enclosed
between braces
Body of the
Method
Any Number of
Parameters
Name of the
MethodValue to be
returned
Modifiers
• public: any method (in any class) can access the
field.
• protected: any method in the same package or any
derived class can access the field.
• private: only methods within the class can access the
field.
• default is that only methods in the same package
can access the field.
Java Programming: OOP 32
•Q& A..?
Thanks..!

More Related Content

PDF
Java
PPTX
Java class 1
PPT
Final keyword in java
PPTX
6. static keyword
PPT
Java static keyword
PPTX
Java 201 Intro to Test Driven Development in Java
PPTX
Android webinar class_java_review
PDF
Beyond PITS, Functional Principles for Software Architecture
Java
Java class 1
Final keyword in java
6. static keyword
Java static keyword
Java 201 Intro to Test Driven Development in Java
Android webinar class_java_review
Beyond PITS, Functional Principles for Software Architecture

What's hot (17)

PPT
Core Java Programming | Data Type | operator | java Control Flow| Class 2
PDF
Unit 2 Part 1 Constructors.pdf
DOCX
SQL Interview Questions For Experienced
PPTX
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
ODP
Preparing Java 7 Certifications
PPTX
Scala-Ls1
ODP
Introduction to Scala JS
PPTX
Java 101 Intro to Java Programming - Exercises
PPTX
Introduction to Scala
PPTX
Java notes(OOP) jkuat IT esection
PPTX
Java 101 Intro to Java Programming
PPTX
Java 102 intro to object-oriented programming in java
PPTX
Introduction To Vavr: A Functional Java Library
DOCX
Java Interview Questions For Freshers
PPTX
Chapter 2 java
PPTX
Static keyword ppt
PPTX
Java 101 intro to programming with java
Core Java Programming | Data Type | operator | java Control Flow| Class 2
Unit 2 Part 1 Constructors.pdf
SQL Interview Questions For Experienced
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
Preparing Java 7 Certifications
Scala-Ls1
Introduction to Scala JS
Java 101 Intro to Java Programming - Exercises
Introduction to Scala
Java notes(OOP) jkuat IT esection
Java 101 Intro to Java Programming
Java 102 intro to object-oriented programming in java
Introduction To Vavr: A Functional Java Library
Java Interview Questions For Freshers
Chapter 2 java
Static keyword ppt
Java 101 intro to programming with java
Ad

Similar to Java Review (20)

PPTX
Programming in java basics
PPTX
Java 101
PPTX
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
PPTX
Java UNITbgbgbfdbv v bbfbf cvbgfbvc gf 1.pptx
PPTX
Learn To Code: Introduction to java
PPT
Java Tutorial | My Heart
PPT
Java_Tutorial_Introduction_to_Core_java.ppt
PPT
Java Tutorial
PPT
Javatut1
PPT
Java tut1 Coderdojo Cahersiveen
PPT
Java tut1
PPT
Java tut1
PPTX
Introduction to java 101
ODP
Synapseindia reviews.odp.
PPT
Java teaching ppt for the freshers in colleeg.ppt
PPTX
JAVA in Artificial intelligent
PPTX
java in Aartificial intelligent by virat andodariya
PPTX
Fundamentals of java --- version 2
PPTX
Core Java introduction | Basics | free course
Programming in java basics
Java 101
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
Java UNITbgbgbfdbv v bbfbf cvbgfbvc gf 1.pptx
Learn To Code: Introduction to java
Java Tutorial | My Heart
Java_Tutorial_Introduction_to_Core_java.ppt
Java Tutorial
Javatut1
Java tut1 Coderdojo Cahersiveen
Java tut1
Java tut1
Introduction to java 101
Synapseindia reviews.odp.
Java teaching ppt for the freshers in colleeg.ppt
JAVA in Artificial intelligent
java in Aartificial intelligent by virat andodariya
Fundamentals of java --- version 2
Core Java introduction | Basics | free course
Ad

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Approach and Philosophy of On baking technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
MYSQL Presentation for SQL database connectivity
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Programs and apps: productivity, graphics, security and other tools
20250228 LYD VKU AI Blended-Learning.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Digital-Transformation-Roadmap-for-Companies.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Understanding_Digital_Forensics_Presentation.pptx
sap open course for s4hana steps from ECC to s4
Approach and Philosophy of On baking technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Building Integrated photovoltaic BIPV_UPV.pdf
The AUB Centre for AI in Media Proposal.docx
Unlocking AI with Model Context Protocol (MCP)
MYSQL Presentation for SQL database connectivity
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Programs and apps: productivity, graphics, security and other tools

Java Review

  • 1. Java Review (Essentials of Java for Hadoop)
  • 2. Have You Joined Our LinkedIn Group?
  • 3. What is Java ? • Java - Java is not just a programming language but it is a complete platform for object oriented programming. • JRE - Java standard class libraries which provide Application Programming Interface and JVM together form JRE (Java Runtime Environment). • JDK - JDK (Java development kit) provides all the needed support for software development in Java.
  • 4. Java Virtual Machine (JVM) • Runs the Byte Code. • Makes Java platform independent. • Handles Memory Management.
  • 5. How Java works ? • Java compilers convert your code from human readable to so ethi g alled bytecode i the Ja a orld. • Bytecode is i terpreted y a JVM, which operates much like a physical CPU to actually execute the compiled code. • Just-in-time (JIT) compiler is a program that turns Java bytecode into instructions that can be sent directly to the processor.
  • 8. Data Types in Java • Data types define the nature of a value • We need different data-types to handle real-world information Name Size (in bits) Range long 64 -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 int 32 –2,147,483,648 to 2,147,483,647 Short 16 –32,768 to 32,767 byte 8 –128 to 127 double 64 4.9e–324 to 1.8e+308 float 32 1.4e–045 to 3.4e+038 char 16 0 to 65,536 boolean ?? true/false
  • 9. Naming Convention of Variables • Can start with a letter, an underscore(_), or a dollar sign ($) • Cannot start with a number.  long _LongNumber = 9999999;  String firstName = Joh ;  float $Val = 2.3f;  int i, index = 2;  double gamma = 1.2;  boolean value2 = false;
  • 10. Operators • Provide a way to perform different operations on variables • Categories of Java Operators Assignment Operators = Arithmetic Operators - + * / % Relational Operators > < >= <= == != Logical Operators && || & | ^ Unary Operators + - ++ -- !
  • 11. Assignment and Arithmetic Operators • Used to assign a value to a variable • Syntax – <variable> = <expression> • Java provides eight Arithmetic operators: – for addition, subtraction, multiplication, division, modulo (or remainder), increment (or add 1), decrement (or subtract 1), and negation. Assignment Operator =
  • 12. Relational Operators • Used to compare two values. • Binary operators, and their operands are numeric expressions. Relational Operators > < >= <= == !=
  • 13. Logical Operators • Return a true or false value based on the state of the variables • There are six logical operators Conditional AND Conditional OR AND OR NOT Exclusive OR Logical Operators && || & | ! ^
  • 14. Static versus Non-static Variables • Static variables are shared across all the objects of a class – There is only one copy • Non-Static variables are not shared – There is a separate copy for each individual live object. • Static variables cannot be declared within a method.
  • 15. Statements & Blocks • A simple statement is a command terminated by a semi-colon: a e = Fred ; • A block is a compound statement enclosed in curly brackets: { a e = Fred ; a e = Bill ; } • Blocks may contain other blocks.
  • 16. Flow of Control • Java executes one statement after the other in the order they are written. • Many Java statements are flow control statements: Alternation: if, if else, switch Looping: for, while, do while
  • 17. Java Basic Constructs • If…else • Switch Statement • For Loop • While Loop • Do...While Loop
  • 18. If else– Syntax if ( <condition> ) { // Execute these statements if <condition> is TRUE } else { // Execute these statements if < condition> is FALSE }
  • 19. switch– Syntax switch (expression) { case cond1: block_1; break; case cond2: block_2; break; ... default: block_default; }
  • 20. For– Syntax for (initialization; condition; increment/decrement) { statement 1; statement 2; . . } Sample: for( int i=0; i<5; i++ ) { System.out.println(i); }
  • 21. For loop - Working For(int i=0; i<5; i++){ Statement 1; Statement 2; }
  • 22. While – Syntax while (condition) { statement 1; statement 2; . . } Sample: int i=0; while (i<5) { System.out.println(i); i++; }
  • 23. While Loop - Working int i=0; while(i < 5){ Statement 1; Statement 2; i++; }
  • 24. Do While – Syntax do { statement 1; statement 2; . . } while (condition) ; Sample: int i=0; do { System.out.println(i); i++; } while (i<5);
  • 25. Do While Loop - Working int i=0; do{ Statement 1; Statement 2; i++; } while(i < 5)
  • 26. Arrays • An array is a list of similar things. • 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.
  • 27. Example of an Array int array [] = new int[5]; for(int i=0; i<5 ; i++) { array[i] = i+1; } 1 2 3 4 5 array[0] array[1] array[2] array[3] array[4]
  • 28. Java Methods & Classes
  • 29. An Example class package com.edureka.entity; // package public class Car{ //class declaration String name; String color; float weight; ... public void move(){ // method ... } }
  • 30. Methods • A method is a named sequence of code that can be invoked by other Java code. • A method takes some parameters, performs some computations and then optionally returns a value (or object). Ex: public float convert_to _Celsius( float temp) { return(((temp * 9.0f) / 5.0f) + 32.0f ); }
  • 31. return_type method_name (arg1, arg2, arg3) { ____ ____ } Methods Methods have five components: • Modifiers • The return type • The method name • The parameter list in parenthesis • The method body, enclosed between braces Body of the Method Any Number of Parameters Name of the MethodValue to be returned
  • 32. Modifiers • public: any method (in any class) can access the field. • protected: any method in the same package or any derived class can access the field. • private: only methods within the class can access the field. • default is that only methods in the same package can access the field. Java Programming: OOP 32