SlideShare a Scribd company logo
1 of 28
 Final 
 Synchronized 
 Abstract 
 static
 The final keyword prevents a method from being overridden 
in a subclass 
class SuperClass{ 
public final void showSample() 
{ 
System.out.println("One thing."); 
} 
} 
class SubClass extends SuperClass{ 
public void showSample() 
{ 
// Try to override the final 
// superclass method 
System.out.println("Another thing."); 
} 
}
class Bank 
{ 
int accountBalance ; 
public Bank(){ 
accountbalance = 10000; 
} 
Synchronized void BalanceInquiry(){ 
System.out.println(“account 
balance is :”+accountbalance); 
} 
}
abstract class Hotel 
{ 
public void Idli(){ 
System.out.println(“Prepare Idli”); 
} 
abstract public void Dosa(); 
}
class Pageview 
{ 
public static final int count = 0; 
public Pageview() 
{ 
count++; 
System.out.println(“Number of views 
to website”+count); 
} 
public static void main(String args[]) 
{ 
Pageview p = new Pageview(); 
} 
}
 Arithmetic Operators 
 Relational Operators 
 Bitwise Operators 
 Logical Operators 
 Assignment Operators
 Bitwise operator works on bits and performs bit-by-bit operation. Assume 
if a = 60; and b = 13; now in binary format they will be as follows: 
 a = 0011 1100 
 b = 0000 1101 
 ------------------------------------------------------------------------------------------ 
 a & b = 0000 1100 
 a || b = 0011 1101 
 a ^ b = 0011 0001 
 ~a = 1100 0011
 Conditional Operators are also called ternary 
operator 
 This operator consists of three operands. 
 It is used to evaluate an expressions 
 Syntax: 
variable x = (expression) ? value if true : value if 
false
public class Test{ 
public static void main(String args[]) 
{ 
int a, b; 
a = 10; 
b = 20; 
( a > b ) ? a : b ; 
( a <10 ) ? a : b ; 
} 
}
 Methods declared public in a superclass also must be public in 
all subclasses. 
 Methods declared protected in a superclass must either be 
protected or public in subclasses; they cannot be private. 
 Methods declared without access control (no modifier was 
used) can be declared more private in subclasses. 
 Methods declared private are not inherited at all, so there is no 
rule for them.
Java(Access Modifiers)

More Related Content

What's hot

20120810 tsql tips
20120810 tsql tips20120810 tsql tips
20120810 tsql tips
LearningTech
 
Flow Chart & Input Output Statement [3] M
Flow Chart & Input Output Statement [3] MFlow Chart & Input Output Statement [3] M
Flow Chart & Input Output Statement [3] M
ecko_disasterz
 
Functions oracle (pl/sql)
Functions oracle (pl/sql)Functions oracle (pl/sql)
Functions oracle (pl/sql)
harman kaur
 

What's hot (20)

Immutability and Javascript - Nadia Miętkiewicz
Immutability and Javascript - Nadia MiętkiewiczImmutability and Javascript - Nadia Miętkiewicz
Immutability and Javascript - Nadia Miętkiewicz
 
Operators in C & C++ Language
Operators in C & C++ LanguageOperators in C & C++ Language
Operators in C & C++ Language
 
Presentation on logical_operators
Presentation on logical_operatorsPresentation on logical_operators
Presentation on logical_operators
 
Functions
FunctionsFunctions
Functions
 
Chapter 5 Basic operators in programming
Chapter 5   Basic operators in programmingChapter 5   Basic operators in programming
Chapter 5 Basic operators in programming
 
Compiler Construction for DLX Processor
Compiler Construction for DLX Processor Compiler Construction for DLX Processor
Compiler Construction for DLX Processor
 
Flowcharting
FlowchartingFlowcharting
Flowcharting
 
Array menu
Array menuArray menu
Array menu
 
20120810 tsql tips
20120810 tsql tips20120810 tsql tips
20120810 tsql tips
 
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMPROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
 
Loop Statements [5] M
Loop Statements [5] MLoop Statements [5] M
Loop Statements [5] M
 
Java 2
Java 2Java 2
Java 2
 
Flow Chart & Input Output Statement [3] M
Flow Chart & Input Output Statement [3] MFlow Chart & Input Output Statement [3] M
Flow Chart & Input Output Statement [3] M
 
Control statements in java programmng
Control statements in java programmngControl statements in java programmng
Control statements in java programmng
 
Stack1
Stack1Stack1
Stack1
 
Java this keyword ppt with example
Java this keyword ppt with exampleJava this keyword ppt with example
Java this keyword ppt with example
 
Basics of c programming cit r.sandhiya
Basics of c programming  cit r.sandhiyaBasics of c programming  cit r.sandhiya
Basics of c programming cit r.sandhiya
 
Api error handling
Api error handlingApi error handling
Api error handling
 
4. operators in c programming by digital wave
4. operators in  c programming by digital wave4. operators in  c programming by digital wave
4. operators in c programming by digital wave
 
Functions oracle (pl/sql)
Functions oracle (pl/sql)Functions oracle (pl/sql)
Functions oracle (pl/sql)
 

Viewers also liked

Visibility control in java
Visibility control in javaVisibility control in java
Visibility control in java
Tech_MX
 
Dft and its applications
Dft and its applicationsDft and its applications
Dft and its applications
Agam Goel
 

Viewers also liked (20)

Access modifiers in java
Access modifiers in javaAccess modifiers in java
Access modifiers in java
 
Access modifiers in java
Access modifiers in javaAccess modifiers in java
Access modifiers in java
 
Java access modifiers
Java access modifiersJava access modifiers
Java access modifiers
 
12 java modifiers
12 java modifiers12 java modifiers
12 java modifiers
 
Visibility control in java
Visibility control in javaVisibility control in java
Visibility control in java
 
Access specifier in java
Access specifier in javaAccess specifier in java
Access specifier in java
 
Introduction to DFT Part 1
Introduction to DFT Part 1 Introduction to DFT Part 1
Introduction to DFT Part 1
 
Dft and its applications
Dft and its applicationsDft and its applications
Dft and its applications
 
6. static keyword
6. static keyword6. static keyword
6. static keyword
 
The Fast Fourier Transform (FFT)
The Fast Fourier Transform (FFT)The Fast Fourier Transform (FFT)
The Fast Fourier Transform (FFT)
 
Java static keyword
Java static keywordJava static keyword
Java static keyword
 
Static keyword ppt
Static keyword pptStatic keyword ppt
Static keyword ppt
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
 
Packages and inbuilt classes of java
Packages and inbuilt classes of javaPackages and inbuilt classes of java
Packages and inbuilt classes of java
 
Packages in java
Packages in javaPackages in java
Packages in java
 
JDBC Tutorial
JDBC TutorialJDBC Tutorial
JDBC Tutorial
 
Java packages
Java packagesJava packages
Java packages
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Fast Fourier Transform
Fast Fourier TransformFast Fourier Transform
Fast Fourier Transform
 

Similar to Java(Access Modifiers)

This is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdfThis is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdf
indiaartz
 
Indicate whether each of the following statements is true or false.docx
Indicate whether each of the following statements is true or false.docxIndicate whether each of the following statements is true or false.docx
Indicate whether each of the following statements is true or false.docx
migdalialyle
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
Rajeev Sharan
 

Similar to Java(Access Modifiers) (20)

Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressions
 
5_Operators.pdf
5_Operators.pdf5_Operators.pdf
5_Operators.pdf
 
eee2-day4-structures engineering college
eee2-day4-structures engineering collegeeee2-day4-structures engineering college
eee2-day4-structures engineering college
 
Operators
OperatorsOperators
Operators
 
Operators
OperatorsOperators
Operators
 
Chap2 class,objects contd
Chap2 class,objects contdChap2 class,objects contd
Chap2 class,objects contd
 
Functional Programming in Java 8
Functional Programming in Java 8Functional Programming in Java 8
Functional Programming in Java 8
 
Class 6 2ciclo
Class 6 2cicloClass 6 2ciclo
Class 6 2ciclo
 
Java session4
Java session4Java session4
Java session4
 
Major Java 8 features
Major Java 8 featuresMajor Java 8 features
Major Java 8 features
 
control statements of clangauge (ii unit)
control statements of clangauge (ii unit)control statements of clangauge (ii unit)
control statements of clangauge (ii unit)
 
This is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdfThis is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdf
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
 
Python Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsPython Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and Functions
 
C#2
C#2C#2
C#2
 
Java chapter 3
Java chapter 3Java chapter 3
Java chapter 3
 
Keyword of java
Keyword of javaKeyword of java
Keyword of java
 
Indicate whether each of the following statements is true or false.docx
Indicate whether each of the following statements is true or false.docxIndicate whether each of the following statements is true or false.docx
Indicate whether each of the following statements is true or false.docx
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
 
Procedure and Functions in pl/sql
Procedure and Functions in pl/sqlProcedure and Functions in pl/sql
Procedure and Functions in pl/sql
 

More from Shridhar Ramesh (6)

Core java
Core javaCore java
Core java
 
Java Object-Oriented Programming Conecpts(Real-Time) Examples
Java Object-Oriented Programming Conecpts(Real-Time) ExamplesJava Object-Oriented Programming Conecpts(Real-Time) Examples
Java Object-Oriented Programming Conecpts(Real-Time) Examples
 
Java
JavaJava
Java
 
Java2
Java2Java2
Java2
 
Java
JavaJava
Java
 
Android
AndroidAndroid
Android
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 

Java(Access Modifiers)

  • 1.
  • 2.
  • 3.  Final  Synchronized  Abstract  static
  • 4.  The final keyword prevents a method from being overridden in a subclass class SuperClass{ public final void showSample() { System.out.println("One thing."); } } class SubClass extends SuperClass{ public void showSample() { // Try to override the final // superclass method System.out.println("Another thing."); } }
  • 5. class Bank { int accountBalance ; public Bank(){ accountbalance = 10000; } Synchronized void BalanceInquiry(){ System.out.println(“account balance is :”+accountbalance); } }
  • 6. abstract class Hotel { public void Idli(){ System.out.println(“Prepare Idli”); } abstract public void Dosa(); }
  • 7. class Pageview { public static final int count = 0; public Pageview() { count++; System.out.println(“Number of views to website”+count); } public static void main(String args[]) { Pageview p = new Pageview(); } }
  • 8.  Arithmetic Operators  Relational Operators  Bitwise Operators  Logical Operators  Assignment Operators
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.  Bitwise operator works on bits and performs bit-by-bit operation. Assume if a = 60; and b = 13; now in binary format they will be as follows:  a = 0011 1100  b = 0000 1101  ------------------------------------------------------------------------------------------  a & b = 0000 1100  a || b = 0011 1101  a ^ b = 0011 0001  ~a = 1100 0011
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.  Conditional Operators are also called ternary operator  This operator consists of three operands.  It is used to evaluate an expressions  Syntax: variable x = (expression) ? value if true : value if false
  • 26. public class Test{ public static void main(String args[]) { int a, b; a = 10; b = 20; ( a > b ) ? a : b ; ( a <10 ) ? a : b ; } }
  • 27.  Methods declared public in a superclass also must be public in all subclasses.  Methods declared protected in a superclass must either be protected or public in subclasses; they cannot be private.  Methods declared without access control (no modifier was used) can be declared more private in subclasses.  Methods declared private are not inherited at all, so there is no rule for them.