SlideShare a Scribd company logo
Character class and String Class
•What is character class?
•What are methods in character class
•Tasks?
4/10/2019 1Jamsher Bhanbhro(F16CS11)
Character class
• Using objects instead of primitive data types is
known as wrapper class.
• Converting Primitive data type to object data is
known as Boxing
Character ob=new Character(‘j’);
• Character objects has advantage of auto-
boxing and un-boxing.
• Escape Sequence: A character preceded by a
backslash is an esc sequence. /b,/t,/n/,//,/r,/’,/’’
4/10/2019 Jamsher Bhanbhro(F16CS11) 2
Character’s sub classes Methods
• isLetter(): whether the specified character is a letter.
• isDigit(): whether the specified character is a digit.
• isWhitespace(): Determines whether specified
character value is white space.
• isUpperCase()/isLowerCase(): for case identification.
No return any value.
• toUpperCase()/toLowerCase(): returns upper/lower
case value.
• toString(): returns one character string value.
4/10/2019 Jamsher Bhanbhro(F16CS11) 3
String Class
• In other we say collection of characters.
• In Java programming language, strings are treated
as objects.
• String class is used in java for creation and
Manipulation of strings.
• We can Create Strings directly as shown below
• String ob= “MUETCSE”;
• Char c ={‘M’, ‘U’, ‘E’, ‘T’} this will be called by
using new Keyword through constructor.
4/10/2019 Jamsher Bhanbhro(F16CS11) 4
String Class Cont…
• When an String object is created it is valued
cannot modified or changed.
• So we Can by using StringBuffer and
StringBuilder Classes.
• Methods of both classes are same but
SetBuilder class methods is not thread safe so
those are fast.
4/10/2019 Jamsher Bhanbhro(F16CS11) 5
StringBuffer Class Methods
• StringBuffer append(String s): append(combine)
the object’s value that invokes this method.
• StringBuffer reverse(): Reverse the value of the
string object that invokes this method.
• public delete(int start, int end): Deletes the
objects value from given starting index to last
index’s value.
• public insert(int offset, int i): Inserts an string at
the address given in the offset.
• replace(int start, int end, String str): For
Replacement of the value
4/10/2019 Jamsher Bhanbhro(F16CS11) 6

More Related Content

What's hot

Data types in java
Data types in javaData types in java
Data types in java
HarshitaAshwani
 
Classes,object and methods jav
Classes,object and methods javClasses,object and methods jav
Classes,object and methods jav
Padma Kannan
 
C Structures & Unions
C Structures & UnionsC Structures & Unions
C Structures & Unions
Ram Sagar Mourya
 
Bad smells in code
Bad smells in codeBad smells in code
Bad smells in code
Đới Học viện Agile
 
Structure in C language
Structure in C languageStructure in C language
Structure in C language
CGC Technical campus,Mohali
 
Java tutorial part 3
Java tutorial part 3Java tutorial part 3
Java tutorial part 3
Mumbai Academisc
 
C programing -Structure
C programing -StructureC programing -Structure
C programing -Structure
shaibal sharif
 
Refactoring Chapter11
Refactoring Chapter11Refactoring Chapter11
Refactoring Chapter11
Abner Chih Yi Huang
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
eShikshak
 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
topu93
 
Unit 9. Structure and Unions
Unit 9. Structure and UnionsUnit 9. Structure and Unions
Unit 9. Structure and Unions
Ashim Lamichhane
 
Scala style-guide
Scala style-guideScala style-guide
Scala style-guide
Knoldus Inc.
 
Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third Year
Dezyneecole
 
JAVA Polymorphism
JAVA PolymorphismJAVA Polymorphism
JAVA Polymorphism
Mahi Mca
 
Constructor and Destructors in C++
Constructor and Destructors in C++Constructor and Destructors in C++
Constructor and Destructors in C++
sandeep54552
 
Inheritance
InheritanceInheritance
Inheritance
Pranali Chaudhari
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
Spotle.ai
 
Constructor & Destructor
Constructor & DestructorConstructor & Destructor
Constructor & Destructor
KV(AFS) Utarlai, Barmer (Rajasthan)
 

What's hot (20)

Data types in java
Data types in javaData types in java
Data types in java
 
Classes,object and methods jav
Classes,object and methods javClasses,object and methods jav
Classes,object and methods jav
 
C Structures & Unions
C Structures & UnionsC Structures & Unions
C Structures & Unions
 
Constructor & destructor
Constructor & destructorConstructor & destructor
Constructor & destructor
 
Bad smells in code
Bad smells in codeBad smells in code
Bad smells in code
 
Structure in C language
Structure in C languageStructure in C language
Structure in C language
 
Java tutorial part 3
Java tutorial part 3Java tutorial part 3
Java tutorial part 3
 
C programing -Structure
C programing -StructureC programing -Structure
C programing -Structure
 
Refactoring Chapter11
Refactoring Chapter11Refactoring Chapter11
Refactoring Chapter11
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
 
Unit 9. Structure and Unions
Unit 9. Structure and UnionsUnit 9. Structure and Unions
Unit 9. Structure and Unions
 
Scala style-guide
Scala style-guideScala style-guide
Scala style-guide
 
Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third Year
 
JAVA Polymorphism
JAVA PolymorphismJAVA Polymorphism
JAVA Polymorphism
 
Constructor and Destructors in C++
Constructor and Destructors in C++Constructor and Destructors in C++
Constructor and Destructors in C++
 
Inheritance
InheritanceInheritance
Inheritance
 
Lect 9(pointers) Zaheer Abbas
Lect 9(pointers) Zaheer AbbasLect 9(pointers) Zaheer Abbas
Lect 9(pointers) Zaheer Abbas
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
 
Constructor & Destructor
Constructor & DestructorConstructor & Destructor
Constructor & Destructor
 

Similar to Lect10

Lect9
Lect9Lect9
Strings in java
Strings in javaStrings in java
Strings in java
Kuppusamy P
 
Module-1 Strings Handling.ppt.pdf
Module-1 Strings Handling.ppt.pdfModule-1 Strings Handling.ppt.pdf
Module-1 Strings Handling.ppt.pdf
learnEnglish51
 
Charcater and Strings.ppt Charcater and Strings.ppt
Charcater and Strings.ppt Charcater and Strings.pptCharcater and Strings.ppt Charcater and Strings.ppt
Charcater and Strings.ppt Charcater and Strings.ppt
mulualem37
 
String Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and InterfacesString Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and Interfaces
Prabu U
 
Java Arrays and DateTime Functions
Java Arrays and DateTime FunctionsJava Arrays and DateTime Functions
Java Arrays and DateTime Functions
Jamsher bhanbhro
 
StringBuffer.pptx
StringBuffer.pptxStringBuffer.pptx
StringBuffer.pptx
meenakshi pareek
 
Day_5.1.pptx
Day_5.1.pptxDay_5.1.pptx
Day_5.1.pptx
ishasharma835109
 
String and string manipulation
String and string manipulationString and string manipulation
String and string manipulationShahjahan Samoon
 
String and string manipulation x
String and string manipulation xString and string manipulation x
String and string manipulation xShahjahan Samoon
 
DAY_1.3.pptx
DAY_1.3.pptxDAY_1.3.pptx
DAY_1.3.pptx
ishasharma835109
 
String.ppt
String.pptString.ppt
String.ppt
ajeela mushtaq
 
Java R20 - UNIT-5.docx
Java R20 - UNIT-5.docxJava R20 - UNIT-5.docx
Java R20 - UNIT-5.docx
Pamarthi Kumar
 
Java R20 - UNIT-5.pdf
Java R20 - UNIT-5.pdfJava R20 - UNIT-5.pdf
Java R20 - UNIT-5.pdf
Pamarthi Kumar
 
Java Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptxJava Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptx
OmarBinkasimSefat
 

Similar to Lect10 (20)

Lect9
Lect9Lect9
Lect9
 
Strings in java
Strings in javaStrings in java
Strings in java
 
Module-1 Strings Handling.ppt.pdf
Module-1 Strings Handling.ppt.pdfModule-1 Strings Handling.ppt.pdf
Module-1 Strings Handling.ppt.pdf
 
Charcater and Strings.ppt Charcater and Strings.ppt
Charcater and Strings.ppt Charcater and Strings.pptCharcater and Strings.ppt Charcater and Strings.ppt
Charcater and Strings.ppt Charcater and Strings.ppt
 
String Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and InterfacesString Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and Interfaces
 
M C6java7
M C6java7M C6java7
M C6java7
 
Java Arrays and DateTime Functions
Java Arrays and DateTime FunctionsJava Arrays and DateTime Functions
Java Arrays and DateTime Functions
 
StringBuffer.pptx
StringBuffer.pptxStringBuffer.pptx
StringBuffer.pptx
 
Day_5.1.pptx
Day_5.1.pptxDay_5.1.pptx
Day_5.1.pptx
 
String and string manipulation
String and string manipulationString and string manipulation
String and string manipulation
 
String and string manipulation x
String and string manipulation xString and string manipulation x
String and string manipulation x
 
DAY_1.3.pptx
DAY_1.3.pptxDAY_1.3.pptx
DAY_1.3.pptx
 
String.ppt
String.pptString.ppt
String.ppt
 
Strings
StringsStrings
Strings
 
Java R20 - UNIT-5.docx
Java R20 - UNIT-5.docxJava R20 - UNIT-5.docx
Java R20 - UNIT-5.docx
 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
 
Java Day-4
Java Day-4Java Day-4
Java Day-4
 
Java R20 - UNIT-5.pdf
Java R20 - UNIT-5.pdfJava R20 - UNIT-5.pdf
Java R20 - UNIT-5.pdf
 
Java Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptxJava Object Orientend Programming 1.pptx
Java Object Orientend Programming 1.pptx
 
106da session5 c++
106da session5 c++106da session5 c++
106da session5 c++
 

More from Jamsher bhanbhro

Abstraction in Java: Abstract class and Interfaces
Abstraction in  Java: Abstract class and InterfacesAbstraction in  Java: Abstract class and Interfaces
Abstraction in Java: Abstract class and Interfaces
Jamsher bhanbhro
 
Method, Constructor, Method Overloading, Method Overriding, Inheritance In Java
Method, Constructor, Method Overloading, Method Overriding, Inheritance In  JavaMethod, Constructor, Method Overloading, Method Overriding, Inheritance In  Java
Method, Constructor, Method Overloading, Method Overriding, Inheritance In Java
Jamsher bhanbhro
 
Regular Expressions in Java.
Regular Expressions in Java.Regular Expressions in Java.
Regular Expressions in Java.
Jamsher bhanbhro
 
Lect8
Lect8Lect8
Lect7
Lect7Lect7
Lect6
Lect6Lect6
Lect5
Lect5Lect5
Lect4
Lect4Lect4
Compiling and understanding first program in java
Compiling and understanding first program in javaCompiling and understanding first program in java
Compiling and understanding first program in java
Jamsher bhanbhro
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Jamsher bhanbhro
 
Caap presentation by me
Caap presentation by meCaap presentation by me
Caap presentation by me
Jamsher bhanbhro
 
Introduction to parts of Computer(Computer Fundamentals)
Introduction to parts of Computer(Computer Fundamentals)Introduction to parts of Computer(Computer Fundamentals)
Introduction to parts of Computer(Computer Fundamentals)
Jamsher bhanbhro
 

More from Jamsher bhanbhro (12)

Abstraction in Java: Abstract class and Interfaces
Abstraction in  Java: Abstract class and InterfacesAbstraction in  Java: Abstract class and Interfaces
Abstraction in Java: Abstract class and Interfaces
 
Method, Constructor, Method Overloading, Method Overriding, Inheritance In Java
Method, Constructor, Method Overloading, Method Overriding, Inheritance In  JavaMethod, Constructor, Method Overloading, Method Overriding, Inheritance In  Java
Method, Constructor, Method Overloading, Method Overriding, Inheritance In Java
 
Regular Expressions in Java.
Regular Expressions in Java.Regular Expressions in Java.
Regular Expressions in Java.
 
Lect8
Lect8Lect8
Lect8
 
Lect7
Lect7Lect7
Lect7
 
Lect6
Lect6Lect6
Lect6
 
Lect5
Lect5Lect5
Lect5
 
Lect4
Lect4Lect4
Lect4
 
Compiling and understanding first program in java
Compiling and understanding first program in javaCompiling and understanding first program in java
Compiling and understanding first program in java
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Caap presentation by me
Caap presentation by meCaap presentation by me
Caap presentation by me
 
Introduction to parts of Computer(Computer Fundamentals)
Introduction to parts of Computer(Computer Fundamentals)Introduction to parts of Computer(Computer Fundamentals)
Introduction to parts of Computer(Computer Fundamentals)
 

Recently uploaded

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 

Recently uploaded (20)

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 

Lect10

  • 1. Character class and String Class •What is character class? •What are methods in character class •Tasks? 4/10/2019 1Jamsher Bhanbhro(F16CS11)
  • 2. Character class • Using objects instead of primitive data types is known as wrapper class. • Converting Primitive data type to object data is known as Boxing Character ob=new Character(‘j’); • Character objects has advantage of auto- boxing and un-boxing. • Escape Sequence: A character preceded by a backslash is an esc sequence. /b,/t,/n/,//,/r,/’,/’’ 4/10/2019 Jamsher Bhanbhro(F16CS11) 2
  • 3. Character’s sub classes Methods • isLetter(): whether the specified character is a letter. • isDigit(): whether the specified character is a digit. • isWhitespace(): Determines whether specified character value is white space. • isUpperCase()/isLowerCase(): for case identification. No return any value. • toUpperCase()/toLowerCase(): returns upper/lower case value. • toString(): returns one character string value. 4/10/2019 Jamsher Bhanbhro(F16CS11) 3
  • 4. String Class • In other we say collection of characters. • In Java programming language, strings are treated as objects. • String class is used in java for creation and Manipulation of strings. • We can Create Strings directly as shown below • String ob= “MUETCSE”; • Char c ={‘M’, ‘U’, ‘E’, ‘T’} this will be called by using new Keyword through constructor. 4/10/2019 Jamsher Bhanbhro(F16CS11) 4
  • 5. String Class Cont… • When an String object is created it is valued cannot modified or changed. • So we Can by using StringBuffer and StringBuilder Classes. • Methods of both classes are same but SetBuilder class methods is not thread safe so those are fast. 4/10/2019 Jamsher Bhanbhro(F16CS11) 5
  • 6. StringBuffer Class Methods • StringBuffer append(String s): append(combine) the object’s value that invokes this method. • StringBuffer reverse(): Reverse the value of the string object that invokes this method. • public delete(int start, int end): Deletes the objects value from given starting index to last index’s value. • public insert(int offset, int i): Inserts an string at the address given in the offset. • replace(int start, int end, String str): For Replacement of the value 4/10/2019 Jamsher Bhanbhro(F16CS11) 6