SlideShare a Scribd company logo
1 of 16
Learn To Code: Diving Deep into Java
Jahnavi Bollineni
Core Team Member
T R Sai Rakshith
Technical Team Member
Java Methods
● Java Methods can be defined as a collection of statements that perform a specific task
and return the result to the caller.
● A method can also perform a specific task without returning anything.
● Retyping the code makes it difficult to interpret and decreases the code quality.
Methods help us in reusing the code.
● A method needs to be called to use its functionality.
● When you call the System.out.println() method, the system executes several
statements in order to display a message on the console.
Features of Java Methods
●Reducing Duplication of Code.
●Making complex problem to simpler ones.
●Improving quality of code.
●Reusing of Code
●Information hiding
Components of Methods
●Modifier
●The return type.
●Method name
●Parameter List
●Exception List
●Method Body
●Method Signature
Components of Methods
Calling a Method
In Java, a method needs to be called for using
its various functionalities. There can be three
situations when a method is called:-
● It completes all the statements in the method.
● It reaches a return statement.
● Throws an exception.
Java Strings
● Strings are used to store text.
● A string variable contains a collection of characters surrounded by double quotes.
● A string in Java is actually an object, which contains methods which can perform
certain operations on strings.
● For Example, the length of a string can be found out using the length() method.
● The indexOf() method returns returns the index of the first occurrence of the
specified text in the string.
● Note: This includes whitespaces as well.
● The + operator can be used between strings to combine them. This process is
referred to as string concatenation.
● We could also use the “concat” method in order to concatenate the strings.
● In order to check if the given string contains a particular word or alphabet we use the
method “contains”
● Use the “endsWith” method and specify the suffix in the arguments.
● Java String Replace, replaceAll and replaceFirst methods. You can specify the part of
the String you want to replace and the replacement String in the arguments.
Java Strings
Arrays
● Collection of similar type of elements.
● Arrays are dynamically allocated.
● Fixed set of elements in a Java array.
Types of Arrays
1.One Dimensional
Array
2.Two Dimensional
Array
Declaring and Initializing an array
int[] age = {12, 4, 5, 2, 5};
// declaration
int[] age = new int[3];
// initialization
age[0] = 12;
age[1] = 4;
age[2] = 5;
1D Array
2D Array
Constructors
● A special method that is used to initialize objects.
● A constructor has the same name as that of the class.
● Does not have any return type.
class Main {
Main() {
// constructor’s body
}
}
Types of Constructors
In Java, constructors can be divided into 2 types:
● No-Argument Constructor
● Parameterized Constructor
Files and I/O
● File handling is an important part of any application.
● Java has several methods for creating, reading, updating, and
deleting files.
● The File class from the java.io package, allows us to work with
files.
● To use the File class, create an object of the class, and specify
the filename or directory name
Thank You!
Shoot your questions.

More Related Content

What's hot

Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2Todor Kolev
 
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...
Core Java Programming Language (JSE) : Chapter III -  Identifiers, Keywords, ...Core Java Programming Language (JSE) : Chapter III -  Identifiers, Keywords, ...
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...WebStackAcademy
 
Scala the good and bad parts
Scala the good and bad partsScala the good and bad parts
Scala the good and bad partsbenewu
 
Basic elements of java
Basic elements of java Basic elements of java
Basic elements of java Ahmad Idrees
 
Pmd naming-rules
Pmd naming-rulesPmd naming-rules
Pmd naming-rules3trg
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageDeveloper’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageAzilen Technologies Pvt. Ltd.
 
Dart PPT.pptx
Dart PPT.pptxDart PPT.pptx
Dart PPT.pptxDSCMESCOE
 
What is-pmd
What is-pmdWhat is-pmd
What is-pmd3trg
 
Introduction Functional Programming - Tech Hangout #11 - 2013.01.16
Introduction Functional Programming - Tech Hangout #11 - 2013.01.16Introduction Functional Programming - Tech Hangout #11 - 2013.01.16
Introduction Functional Programming - Tech Hangout #11 - 2013.01.16Innovecs
 
Code analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDCode analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDKan-Han (John) Lu
 
Object oriented programming interview questions
Object oriented programming interview questionsObject oriented programming interview questions
Object oriented programming interview questionsKeet Sugathadasa
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScriptRajat Saxena
 

What's hot (19)

Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Typescript Basics
Typescript BasicsTypescript Basics
Typescript Basics
 
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...
Core Java Programming Language (JSE) : Chapter III -  Identifiers, Keywords, ...Core Java Programming Language (JSE) : Chapter III -  Identifiers, Keywords, ...
Core Java Programming Language (JSE) : Chapter III - Identifiers, Keywords, ...
 
Scala the good and bad parts
Scala the good and bad partsScala the good and bad parts
Scala the good and bad parts
 
Basic elements of java
Basic elements of java Basic elements of java
Basic elements of java
 
Pmd naming-rules
Pmd naming-rulesPmd naming-rules
Pmd naming-rules
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageDeveloper’s viewpoint on swift programming language
Developer’s viewpoint on swift programming language
 
Dart PPT.pptx
Dart PPT.pptxDart PPT.pptx
Dart PPT.pptx
 
What is-pmd
What is-pmdWhat is-pmd
What is-pmd
 
Java
JavaJava
Java
 
Introduction Functional Programming - Tech Hangout #11 - 2013.01.16
Introduction Functional Programming - Tech Hangout #11 - 2013.01.16Introduction Functional Programming - Tech Hangout #11 - 2013.01.16
Introduction Functional Programming - Tech Hangout #11 - 2013.01.16
 
Introductory func prog
Introductory func progIntroductory func prog
Introductory func prog
 
Concepts of core java
Concepts of core javaConcepts of core java
Concepts of core java
 
Ruby
RubyRuby
Ruby
 
Code analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDCode analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMD
 
Object oriented programming interview questions
Object oriented programming interview questionsObject oriented programming interview questions
Object oriented programming interview questions
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
 
Ocl
OclOcl
Ocl
 

Similar to Learn To Code: Diving deep into java

Similar to Learn To Code: Diving deep into java (20)

Programming in java basics
Programming in java  basicsProgramming in java  basics
Programming in java basics
 
Core Java Introduction | Basics
Core Java Introduction  | BasicsCore Java Introduction  | Basics
Core Java Introduction | Basics
 
Learning core java
Learning core javaLearning core java
Learning core java
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
 
Best practices in Java
Best practices in JavaBest practices in Java
Best practices in Java
 
Android webinar class_java_review
Android webinar class_java_reviewAndroid webinar class_java_review
Android webinar class_java_review
 
Java 8
Java 8Java 8
Java 8
 
Java programing language unit 1 introduction
Java programing language unit 1 introductionJava programing language unit 1 introduction
Java programing language unit 1 introduction
 
Annotations
AnnotationsAnnotations
Annotations
 
CJP Unit-1 contd.pptx
CJP Unit-1 contd.pptxCJP Unit-1 contd.pptx
CJP Unit-1 contd.pptx
 
Testing Spark and Scala
Testing Spark and ScalaTesting Spark and Scala
Testing Spark and Scala
 
Java
JavaJava
Java
 
Chapter 2 java
Chapter 2 javaChapter 2 java
Chapter 2 java
 
Basics of Java
Basics of JavaBasics of Java
Basics of Java
 
javaloop understanding what is java.pptx
javaloop understanding what is java.pptxjavaloop understanding what is java.pptx
javaloop understanding what is java.pptx
 
Fundamental programming structures in java
Fundamental programming structures in javaFundamental programming structures in java
Fundamental programming structures in java
 
Java basics training 1
Java basics training 1Java basics training 1
Java basics training 1
 
Unit 1
Unit 1Unit 1
Unit 1
 
CIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in JavaCIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in Java
 

More from SadhanaParameswaran

Introduction to Web Development - JavaScript
Introduction to Web Development - JavaScriptIntroduction to Web Development - JavaScript
Introduction to Web Development - JavaScriptSadhanaParameswaran
 
Introduction to Web Development - CSS
Introduction to Web Development - CSSIntroduction to Web Development - CSS
Introduction to Web Development - CSSSadhanaParameswaran
 
Introduction to Web Development - HTML
Introduction to Web Development - HTMLIntroduction to Web Development - HTML
Introduction to Web Development - HTMLSadhanaParameswaran
 
Introduction to data science.pptx
Introduction to data science.pptxIntroduction to data science.pptx
Introduction to data science.pptxSadhanaParameswaran
 
Flutter Festivals GDSC ASEB | Introduction to Flutter
Flutter Festivals GDSC ASEB | Introduction to FlutterFlutter Festivals GDSC ASEB | Introduction to Flutter
Flutter Festivals GDSC ASEB | Introduction to FlutterSadhanaParameswaran
 
Flutter Festivals GDSC ASEB | Introduction to Dart
Flutter Festivals GDSC ASEB | Introduction to DartFlutter Festivals GDSC ASEB | Introduction to Dart
Flutter Festivals GDSC ASEB | Introduction to DartSadhanaParameswaran
 
Explore ML with Crowdsource | Neural Networks - Session 3
Explore ML with Crowdsource | Neural Networks - Session 3Explore ML with Crowdsource | Neural Networks - Session 3
Explore ML with Crowdsource | Neural Networks - Session 3SadhanaParameswaran
 
Explore ML with Crowdsource | ML Extended - Session 4
Explore ML with Crowdsource | ML Extended - Session 4Explore ML with Crowdsource | ML Extended - Session 4
Explore ML with Crowdsource | ML Extended - Session 4SadhanaParameswaran
 
Explore ML with Crowdsource | Intro to ML - Session 2
Explore ML with Crowdsource | Intro to ML - Session 2Explore ML with Crowdsource | Intro to ML - Session 2
Explore ML with Crowdsource | Intro to ML - Session 2SadhanaParameswaran
 
Learn To Code: Next steps for python
Learn To Code: Next steps for pythonLearn To Code: Next steps for python
Learn To Code: Next steps for pythonSadhanaParameswaran
 

More from SadhanaParameswaran (18)

Introduction to Web Development - JavaScript
Introduction to Web Development - JavaScriptIntroduction to Web Development - JavaScript
Introduction to Web Development - JavaScript
 
Introduction to Web Development - CSS
Introduction to Web Development - CSSIntroduction to Web Development - CSS
Introduction to Web Development - CSS
 
Introduction to Web Development - HTML
Introduction to Web Development - HTMLIntroduction to Web Development - HTML
Introduction to Web Development - HTML
 
Introduction to data science.pptx
Introduction to data science.pptxIntroduction to data science.pptx
Introduction to data science.pptx
 
Flutter Festivals GDSC ASEB | Introduction to Flutter
Flutter Festivals GDSC ASEB | Introduction to FlutterFlutter Festivals GDSC ASEB | Introduction to Flutter
Flutter Festivals GDSC ASEB | Introduction to Flutter
 
Flutter Festivals GDSC ASEB | Introduction to Dart
Flutter Festivals GDSC ASEB | Introduction to DartFlutter Festivals GDSC ASEB | Introduction to Dart
Flutter Festivals GDSC ASEB | Introduction to Dart
 
Explore ML with Crowdsource | Neural Networks - Session 3
Explore ML with Crowdsource | Neural Networks - Session 3Explore ML with Crowdsource | Neural Networks - Session 3
Explore ML with Crowdsource | Neural Networks - Session 3
 
Explore ML with Crowdsource | ML Extended - Session 4
Explore ML with Crowdsource | ML Extended - Session 4Explore ML with Crowdsource | ML Extended - Session 4
Explore ML with Crowdsource | ML Extended - Session 4
 
Android Study Jams Session 5
Android Study Jams Session 5Android Study Jams Session 5
Android Study Jams Session 5
 
Explore ML with Crowdsource | Intro to ML - Session 2
Explore ML with Crowdsource | Intro to ML - Session 2Explore ML with Crowdsource | Intro to ML - Session 2
Explore ML with Crowdsource | Intro to ML - Session 2
 
Android Study Jams Session 4
Android Study Jams Session 4Android Study Jams Session 4
Android Study Jams Session 4
 
Android Study Jams - Session 3
Android Study Jams - Session 3Android Study Jams - Session 3
Android Study Jams - Session 3
 
Android Study Jams - Session 2
Android Study Jams - Session 2Android Study Jams - Session 2
Android Study Jams - Session 2
 
Android Study Jams - Session 1
Android Study Jams - Session 1Android Study Jams - Session 1
Android Study Jams - Session 1
 
Learn To Code: Next steps for python
Learn To Code: Next steps for pythonLearn To Code: Next steps for python
Learn To Code: Next steps for python
 
Hacktoberfest 2021
Hacktoberfest 2021Hacktoberfest 2021
Hacktoberfest 2021
 
Dominion over domains
Dominion over domainsDominion over domains
Dominion over domains
 
30 days of google cloud 2021
30 days of google cloud 202130 days of google cloud 2021
30 days of google cloud 2021
 

Recently uploaded

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

Learn To Code: Diving deep into java

  • 1. Learn To Code: Diving Deep into Java Jahnavi Bollineni Core Team Member T R Sai Rakshith Technical Team Member
  • 2. Java Methods ● Java Methods can be defined as a collection of statements that perform a specific task and return the result to the caller. ● A method can also perform a specific task without returning anything. ● Retyping the code makes it difficult to interpret and decreases the code quality. Methods help us in reusing the code. ● A method needs to be called to use its functionality. ● When you call the System.out.println() method, the system executes several statements in order to display a message on the console.
  • 3. Features of Java Methods ●Reducing Duplication of Code. ●Making complex problem to simpler ones. ●Improving quality of code. ●Reusing of Code ●Information hiding
  • 4. Components of Methods ●Modifier ●The return type. ●Method name ●Parameter List ●Exception List ●Method Body ●Method Signature
  • 6. Calling a Method In Java, a method needs to be called for using its various functionalities. There can be three situations when a method is called:- ● It completes all the statements in the method. ● It reaches a return statement. ● Throws an exception.
  • 7. Java Strings ● Strings are used to store text. ● A string variable contains a collection of characters surrounded by double quotes. ● A string in Java is actually an object, which contains methods which can perform certain operations on strings. ● For Example, the length of a string can be found out using the length() method. ● The indexOf() method returns returns the index of the first occurrence of the specified text in the string. ● Note: This includes whitespaces as well.
  • 8. ● The + operator can be used between strings to combine them. This process is referred to as string concatenation. ● We could also use the “concat” method in order to concatenate the strings. ● In order to check if the given string contains a particular word or alphabet we use the method “contains” ● Use the “endsWith” method and specify the suffix in the arguments. ● Java String Replace, replaceAll and replaceFirst methods. You can specify the part of the String you want to replace and the replacement String in the arguments. Java Strings
  • 9. Arrays ● Collection of similar type of elements. ● Arrays are dynamically allocated. ● Fixed set of elements in a Java array.
  • 10. Types of Arrays 1.One Dimensional Array 2.Two Dimensional Array
  • 11. Declaring and Initializing an array int[] age = {12, 4, 5, 2, 5}; // declaration int[] age = new int[3]; // initialization age[0] = 12; age[1] = 4; age[2] = 5; 1D Array
  • 13. Constructors ● A special method that is used to initialize objects. ● A constructor has the same name as that of the class. ● Does not have any return type. class Main { Main() { // constructor’s body } }
  • 14. Types of Constructors In Java, constructors can be divided into 2 types: ● No-Argument Constructor ● Parameterized Constructor
  • 15. Files and I/O ● File handling is an important part of any application. ● Java has several methods for creating, reading, updating, and deleting files. ● The File class from the java.io package, allows us to work with files. ● To use the File class, create an object of the class, and specify the filename or directory name
  • 16. Thank You! Shoot your questions.