SlideShare a Scribd company logo
 Packages are used in Java in order to prevent
naming conflicts, to control access, to make
searching/locating and usage of classes, interfaces,
enumerations and annotations easier.
 A Package can be defined as a grouping
of related types (classes, interfaces,
enumerations and annotations ) providing
access protection and namespace management.
The Exception Handling in Java is one
of the powerful mechanism to handle the
runtime errors so that normal flow of the
application can be maintained.
Types of Java Exceptions
 Checked Exception
 Unchecked Exception
 Error
 Checked Exception
The classes which directly inherit Throwable class
except RuntimeException and Error are known as
checked exceptions e.g. IOException, SQLException
etc. Checked exceptions are checked at compile-time.
 Unchecked Exception
The classes which inherit RuntimeException are
known as unchecked exceptions e.g.
ArithmeticException, NullPointerException,
ArrayIndexOutOfBoundsException etc. Unchecked
exceptions are not checked at compile-time, but they
are checked at runtime.
 Error
Error is irrecoverable e.g. OutOfMemoryError,
VirtualMachineError, AssertionError etc.
Example:
public class JavaExceptionExample{
public static void main(String args[]){
try{
int data=100/0;
}
catch(ArithmeticException e){System.out.println(e);}
System.out.println("rest of the code...");
}
}
 Multithreading is a Java feature that allows concurrent
execution of two or more parts of a program for
maximum utilization of CPU. Each part of such
program is called a thread. So, threads are light-weight
processes within a process.
 Threads can be created by using two mechanisms :
1. Extending the Thread class
2. Implementing the Runnable Interface
 Thread creation by extending the Thread class:
We create a class that extends the java.lang.Thread
class. This class overrides the run() method available in
the Thread class. A thread begins its life inside run()
method. We create an object of our new class and call
start() method to start the execution of a thread. Start()
invokes the run() method on the Thread object.
 Thread creation by implementing the Runnable
Interface
We create a new class which implements
java.lang.Runnable interface and override run() method.
Then we instantiate a Thread object and call start()
method on this object.
The String object can be created explicitly by using the new
keyword and a constructor in the same way as you have
created objects previously. For example: The statement
String strl =new String("Java");
creates a String object initialized to the value of the string
literal "Java" and assigns a reference to string reference
variable str. Here, String ("Java") is actually a constructor of
the form String (string literal). When this statement is
compiled , the Java compiler invokes this constructor and
initializes the String object with the string literal enclosed in
parentheses which is passed as an argument.
 Example:
public class StringConstructors
{
public static void main(String[] args)
{
char[] charArray ={'H','i',' ','D','I','N','E','S','H'};
byte[] ascii ={65,66,67,68,70,71,73};
String str = "Welcome";
String strl =new String("Java");
String str2 =new String(charArray);
String str3 =new String(charArray,3,3);
String str4 =new String(ascii);
String str5 =new String(ascii,2,3);
String str6 =new String();
String str7 =new String(str);
System.out.println("str : "+ str);
System.out.println("strl : "+ strl);
System.out.println("str2 : "+ str2);
System.out.println("str3 : "+ str3);
System.out.println("str4 : "+ str4);
System.out.println("str5 : "+ str5);
System.out.println("str6 : "+ str6);
System.out.println("str7 : "+ str7);
str += " Dinesh Thakur";
System.out.println("str : "+ str);
}
}
 String Handling concept is storing the
string data in the main memory (RAM),
manipulating the data of the String,
retrieving the part of the String etc.
String Handling provides a lot of
concepts that can be performed on a
string such as concatenation of string,
comparison of string, find sub string etc.
 StringBuffer is a peer class of String
that provides much of the functionality of
strings. String represents fixed-length,
immutable character sequences while
StringBuffer represents growable and
writable character sequences.
 StringBuffer may have characters and
substrings inserted in the middle or
appended to the end. It will automatically
grow to make room for such additions
and often has more characters
preallocated than are actually needed, to
allow room for growth.
String Buffer Constructors:
 String Buffer()
 String Buffer(int size)
 String Buffer(String str)
 String Buffer(CharSequence chars)
StringBuffer Constructors:
StringBuffer( ):
It reserves room for 16 characters
without reallocation.
StringBuffer s=new StringBuffer();
StringBuffer( int size):
It accepts an integer argument that
explicitly sets the size of the buffer.
StringBuffer s=new StringBuffer(20);
StringBuffer(String str):
 It accepts a String argument that sets the
initial contents of the StringBuffer object and
reserves room for 16 more characters without
reallocation.
 StringBuffer s =
newStringBuffer("GeeksforGeeks");
 Methods:
Some of the most used methods are:
length( ) and capacity( ): The length of a
StringBuffer can be found by the length( )
method, while the total allocated capacity()
methord.
 int length()
 int capacity()
append( ):
It is used to add text at the end of the
existence text. Here are a few of its forms:
 StringBuffer append(String str)
 StringBuffer append(int num) .
insert( ):
It is used to insert text at the specified
index position. These are a few of its forms:
 StringBuffer insert(int index, String str)
 StringBuffer insert(int index, char ch)
 delete( ) and deleteCharAt( ):
o It can delete characters within a StringBuffer
by using the methods delete( ) and
deleteCharAt( ).
o The delete( ) method deletes a sequence of
characters from the invoking object.
o The deleteCharAt( ) method deletes the
character at the index specified by loc.
 StringBuffer delete(int startIndex,
int endIndex)
 StringBuffer deleteCharAt(int loc)
 replace( ):
It can replace one set of characters
with another set inside a StringBuffer
object by calling replace( ). The substring
being replaced is specified by the indexes
start Index and endIndex.
 StringBuffer replace(int startIndex, int
endIndex, String str)
 ensureCapacity( ):
It is used to increase the capacity of a
StringBuffer object. The new capacity will be
set to either the value we specify or twice the
current capacity plus two (i.e. capacity+2),
whichever is larger. Here, capacity specifies
the size of the buffer.
 void ensureCapacity(int capacity)
getchars():
To copy of a substring of a stringbuffer
into a array, use the getchars()
method().Sourcestart specifies the index of the
beginning of the substring, and source end
specifies an index of the end substring.
 Void getchars(int souceStart, int sourceEnd,
char target[], int targetstart)
 reverse():
You can reverse the characters within string
buffer object using reverse().
 String buffer reverse()
 substring():
You can obtain a portion of a string buffer by
calling substring().
 String substring(int starIndex)
 String substring(int startIndex, int endIndex)
 J2SE 5 adds a new string class to Java’s already
powerful string handling capabilities. This new
class is called String Builder.
 It is identical to String Buffer except for one
important difference: it is not synchronized, which
means that it is not thread-safe.
 The advantage of String Builder is faster
performance. However, in cases in which you are
using multithreading, you must use String Buffer
rather than String Builder.
THANK YOU

More Related Content

What's hot

Introduction to Java Strings, By Kavita Ganesan
Introduction to Java Strings, By Kavita GanesanIntroduction to Java Strings, By Kavita Ganesan
Introduction to Java Strings, By Kavita Ganesan
Kavita Ganesan
 
String Builder & String Buffer (Java Programming)
String Builder & String Buffer (Java Programming)String Builder & String Buffer (Java Programming)
String Builder & String Buffer (Java Programming)
Anwar Hasan Shuvo
 
Dive into Python Class
Dive into Python ClassDive into Python Class
Dive into Python ClassJim Yeh
 
String handling session 5
String handling session 5String handling session 5
String handling session 5
Raja Sekhar
 
String handling(string class)
String handling(string class)String handling(string class)
String handling(string class)Ravi Kant Sahu
 
Dr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive inputDr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive input
jalinder123
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
Rasan Samarasinghe
 
Protocols with Associated Types, and How They Got That Way
Protocols with Associated Types, and How They Got That WayProtocols with Associated Types, and How They Got That Way
Protocols with Associated Types, and How They Got That Way
Alexis Gallagher
 
Dotnet programming concepts difference faqs- 2
Dotnet programming concepts difference faqs- 2Dotnet programming concepts difference faqs- 2
Dotnet programming concepts difference faqs- 2Umar Ali
 
The Swift Compiler and Standard Library
The Swift Compiler and Standard LibraryThe Swift Compiler and Standard Library
The Swift Compiler and Standard Library
Santosh Rajan
 
Java strings
Java   stringsJava   strings
Java strings
Mohammed Sikander
 
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5Anton Kasyanov
 
Java - Strings Concepts
Java - Strings ConceptsJava - Strings Concepts
Java - Strings Concepts
Victer Paul
 

What's hot (19)

Introduction to Java Strings, By Kavita Ganesan
Introduction to Java Strings, By Kavita GanesanIntroduction to Java Strings, By Kavita Ganesan
Introduction to Java Strings, By Kavita Ganesan
 
String Builder & String Buffer (Java Programming)
String Builder & String Buffer (Java Programming)String Builder & String Buffer (Java Programming)
String Builder & String Buffer (Java Programming)
 
Dive into Python Class
Dive into Python ClassDive into Python Class
Dive into Python Class
 
String handling session 5
String handling session 5String handling session 5
String handling session 5
 
07slide
07slide07slide
07slide
 
String handling(string class)
String handling(string class)String handling(string class)
String handling(string class)
 
Dr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive inputDr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive input
 
StringTokenizer in java
StringTokenizer in javaStringTokenizer in java
StringTokenizer in java
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Protocols with Associated Types, and How They Got That Way
Protocols with Associated Types, and How They Got That WayProtocols with Associated Types, and How They Got That Way
Protocols with Associated Types, and How They Got That Way
 
Dotnet programming concepts difference faqs- 2
Dotnet programming concepts difference faqs- 2Dotnet programming concepts difference faqs- 2
Dotnet programming concepts difference faqs- 2
 
The Swift Compiler and Standard Library
The Swift Compiler and Standard LibraryThe Swift Compiler and Standard Library
The Swift Compiler and Standard Library
 
Java strings
Java   stringsJava   strings
Java strings
 
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov, Introduction to Python, Lecture5
 
M C6java7
M C6java7M C6java7
M C6java7
 
Java - Strings Concepts
Java - Strings ConceptsJava - Strings Concepts
Java - Strings Concepts
 
Unit 4 qba
Unit 4 qbaUnit 4 qba
Unit 4 qba
 
About Python
About PythonAbout Python
About Python
 
Unit 4 qba
Unit 4 qbaUnit 4 qba
Unit 4 qba
 

Similar to package

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
 
javastringexample problems using string class
javastringexample problems using string classjavastringexample problems using string class
javastringexample problems using string class
fedcoordinator
 
L14 string handling(string buffer class)
L14 string handling(string buffer class)L14 string handling(string buffer class)
L14 string handling(string buffer class)
teach4uin
 
String handling
String handlingString handling
String handling
ssuser20c32b
 
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
 
Lecture 7
Lecture 7Lecture 7
Java string handling
Java string handlingJava string handling
Java string handling
Salman Khan
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arraysphanleson
 
CSE 220 Assignment 3 Hints and Tips Some hints for approa.docx
CSE 220 Assignment 3 Hints and Tips  Some hints for approa.docxCSE 220 Assignment 3 Hints and Tips  Some hints for approa.docx
CSE 220 Assignment 3 Hints and Tips Some hints for approa.docx
faithxdunce63732
 
In the given example only one object will be created. Firstly JVM will not fi...
In the given example only one object will be created. Firstly JVM will not fi...In the given example only one object will be created. Firstly JVM will not fi...
In the given example only one object will be created. Firstly JVM will not fi...
Indu32
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
Eduardo Bergavera
 
Fileoperations.pptx
Fileoperations.pptxFileoperations.pptx
Fileoperations.pptx
VeenaNaik23
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9Vince Vo
 
Java
JavaJava
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIs
İbrahim Kürce
 
Java String Handling
Java String HandlingJava String Handling
Java String Handling
Infoviaan Technologies
 
String handling(string buffer class)
String handling(string buffer class)String handling(string buffer class)
String handling(string buffer class)Ravi Kant Sahu
 

Similar to package (20)

String Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and InterfacesString Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and Interfaces
 
javastringexample problems using string class
javastringexample problems using string classjavastringexample problems using string class
javastringexample problems using string class
 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
 
L14 string handling(string buffer class)
L14 string handling(string buffer class)L14 string handling(string buffer class)
L14 string handling(string buffer class)
 
String handling
String handlingString handling
String handling
 
StringBuffer.pptx
StringBuffer.pptxStringBuffer.pptx
StringBuffer.pptx
 
Day_5.1.pptx
Day_5.1.pptxDay_5.1.pptx
Day_5.1.pptx
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Java string handling
Java string handlingJava string handling
Java string handling
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 
CSE 220 Assignment 3 Hints and Tips Some hints for approa.docx
CSE 220 Assignment 3 Hints and Tips  Some hints for approa.docxCSE 220 Assignment 3 Hints and Tips  Some hints for approa.docx
CSE 220 Assignment 3 Hints and Tips Some hints for approa.docx
 
Strings
StringsStrings
Strings
 
In the given example only one object will be created. Firstly JVM will not fi...
In the given example only one object will be created. Firstly JVM will not fi...In the given example only one object will be created. Firstly JVM will not fi...
In the given example only one object will be created. Firstly JVM will not fi...
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
 
Fileoperations.pptx
Fileoperations.pptxFileoperations.pptx
Fileoperations.pptx
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9
 
Java
JavaJava
Java
 
OCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIsOCA Java SE 8 Exam Chapter 3 Core Java APIs
OCA Java SE 8 Exam Chapter 3 Core Java APIs
 
Java String Handling
Java String HandlingJava String Handling
Java String Handling
 
String handling(string buffer class)
String handling(string buffer class)String handling(string buffer class)
String handling(string buffer class)
 

More from sweetysweety8

Artificial neural network
Artificial neural networkArtificial neural network
Artificial neural network
sweetysweety8
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
sweetysweety8
 
Software engineering
Software engineeringSoftware engineering
Software engineering
sweetysweety8
 
Software engineering
Software engineeringSoftware engineering
Software engineering
sweetysweety8
 
WEB PROGRAMMING ANALYSIS
WEB PROGRAMMING ANALYSISWEB PROGRAMMING ANALYSIS
WEB PROGRAMMING ANALYSIS
sweetysweety8
 
Software engineering
Software engineeringSoftware engineering
Software engineering
sweetysweety8
 
Software engineering
Software engineeringSoftware engineering
Software engineering
sweetysweety8
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
sweetysweety8
 
WEB PROGRAMMING ANALYSIS
WEB PROGRAMMING ANALYSISWEB PROGRAMMING ANALYSIS
WEB PROGRAMMING ANALYSIS
sweetysweety8
 
WEB PROGRAMMING
WEB PROGRAMMINGWEB PROGRAMMING
WEB PROGRAMMING
sweetysweety8
 
Bigdata
BigdataBigdata
Bigdata
sweetysweety8
 
BIG DATA ANALYTICS
BIG DATA ANALYTICSBIG DATA ANALYTICS
BIG DATA ANALYTICS
sweetysweety8
 
BIG DATA ANALYTICS
BIG DATA ANALYTICSBIG DATA ANALYTICS
BIG DATA ANALYTICS
sweetysweety8
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
sweetysweety8
 
WEB PROGRAMMING
WEB PROGRAMMINGWEB PROGRAMMING
WEB PROGRAMMING
sweetysweety8
 
BIG DATA ANALYTICS
BIG DATA ANALYTICSBIG DATA ANALYTICS
BIG DATA ANALYTICS
sweetysweety8
 
Data mining
Data miningData mining
Data mining
sweetysweety8
 
Operating System
Operating SystemOperating System
Operating System
sweetysweety8
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
sweetysweety8
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
sweetysweety8
 

More from sweetysweety8 (20)

Artificial neural network
Artificial neural networkArtificial neural network
Artificial neural network
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
WEB PROGRAMMING ANALYSIS
WEB PROGRAMMING ANALYSISWEB PROGRAMMING ANALYSIS
WEB PROGRAMMING ANALYSIS
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
WEB PROGRAMMING ANALYSIS
WEB PROGRAMMING ANALYSISWEB PROGRAMMING ANALYSIS
WEB PROGRAMMING ANALYSIS
 
WEB PROGRAMMING
WEB PROGRAMMINGWEB PROGRAMMING
WEB PROGRAMMING
 
Bigdata
BigdataBigdata
Bigdata
 
BIG DATA ANALYTICS
BIG DATA ANALYTICSBIG DATA ANALYTICS
BIG DATA ANALYTICS
 
BIG DATA ANALYTICS
BIG DATA ANALYTICSBIG DATA ANALYTICS
BIG DATA ANALYTICS
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
WEB PROGRAMMING
WEB PROGRAMMINGWEB PROGRAMMING
WEB PROGRAMMING
 
BIG DATA ANALYTICS
BIG DATA ANALYTICSBIG DATA ANALYTICS
BIG DATA ANALYTICS
 
Data mining
Data miningData mining
Data mining
 
Operating System
Operating SystemOperating System
Operating System
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 

Recently uploaded

Burning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdfBurning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdf
kkirkland2
 
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AwangAniqkmals
 
Gregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptxGregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptx
gharris9
 
Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
faizulhassanfaiz1670
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Sebastiano Panichella
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Sebastiano Panichella
 
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Dutch Power
 
ASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdfASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdf
ToshihiroIto4
 
Gregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics PresentationGregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics Presentation
gharris9
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Access Innovations, Inc.
 
2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf
Frederic Leger
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
khadija278284
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
eCommerce Institute
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
Sebastiano Panichella
 
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij
 
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Dutch Power
 
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsCollapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Rosie Wells
 
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
SkillCertProExams
 
Tom tresser burning issue.pptx My Burning issue
Tom tresser burning issue.pptx My Burning issueTom tresser burning issue.pptx My Burning issue
Tom tresser burning issue.pptx My Burning issue
amekonnen
 

Recently uploaded (19)

Burning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdfBurning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdf
 
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
AWANG ANIQKMALBIN AWANG TAJUDIN B22080004 ASSIGNMENT 2 MPU3193 PHILOSOPHY AND...
 
Gregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptxGregory Harris' Civics Presentation.pptx
Gregory Harris' Civics Presentation.pptx
 
Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
 
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
 
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
Presentatie 4. Jochen Cremer - TU Delft 28 mei 2024
 
ASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdfASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdf
 
Gregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics PresentationGregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics Presentation
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
 
2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
 
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
 
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
 
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsCollapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
 
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
 
Tom tresser burning issue.pptx My Burning issue
Tom tresser burning issue.pptx My Burning issueTom tresser burning issue.pptx My Burning issue
Tom tresser burning issue.pptx My Burning issue
 

package

  • 1.
  • 2.  Packages are used in Java in order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations easier.  A Package can be defined as a grouping of related types (classes, interfaces, enumerations and annotations ) providing access protection and namespace management.
  • 3. The Exception Handling in Java is one of the powerful mechanism to handle the runtime errors so that normal flow of the application can be maintained. Types of Java Exceptions  Checked Exception  Unchecked Exception  Error
  • 4.
  • 5.  Checked Exception The classes which directly inherit Throwable class except RuntimeException and Error are known as checked exceptions e.g. IOException, SQLException etc. Checked exceptions are checked at compile-time.  Unchecked Exception The classes which inherit RuntimeException are known as unchecked exceptions e.g. ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException etc. Unchecked exceptions are not checked at compile-time, but they are checked at runtime.
  • 6.  Error Error is irrecoverable e.g. OutOfMemoryError, VirtualMachineError, AssertionError etc. Example: public class JavaExceptionExample{ public static void main(String args[]){ try{ int data=100/0; } catch(ArithmeticException e){System.out.println(e);} System.out.println("rest of the code..."); } }
  • 7.  Multithreading is a Java feature that allows concurrent execution of two or more parts of a program for maximum utilization of CPU. Each part of such program is called a thread. So, threads are light-weight processes within a process.  Threads can be created by using two mechanisms : 1. Extending the Thread class 2. Implementing the Runnable Interface
  • 8.  Thread creation by extending the Thread class: We create a class that extends the java.lang.Thread class. This class overrides the run() method available in the Thread class. A thread begins its life inside run() method. We create an object of our new class and call start() method to start the execution of a thread. Start() invokes the run() method on the Thread object.  Thread creation by implementing the Runnable Interface We create a new class which implements java.lang.Runnable interface and override run() method. Then we instantiate a Thread object and call start() method on this object.
  • 9. The String object can be created explicitly by using the new keyword and a constructor in the same way as you have created objects previously. For example: The statement String strl =new String("Java"); creates a String object initialized to the value of the string literal "Java" and assigns a reference to string reference variable str. Here, String ("Java") is actually a constructor of the form String (string literal). When this statement is compiled , the Java compiler invokes this constructor and initializes the String object with the string literal enclosed in parentheses which is passed as an argument.
  • 10.  Example: public class StringConstructors { public static void main(String[] args) { char[] charArray ={'H','i',' ','D','I','N','E','S','H'}; byte[] ascii ={65,66,67,68,70,71,73}; String str = "Welcome"; String strl =new String("Java"); String str2 =new String(charArray); String str3 =new String(charArray,3,3); String str4 =new String(ascii); String str5 =new String(ascii,2,3); String str6 =new String(); String str7 =new String(str);
  • 11. System.out.println("str : "+ str); System.out.println("strl : "+ strl); System.out.println("str2 : "+ str2); System.out.println("str3 : "+ str3); System.out.println("str4 : "+ str4); System.out.println("str5 : "+ str5); System.out.println("str6 : "+ str6); System.out.println("str7 : "+ str7); str += " Dinesh Thakur"; System.out.println("str : "+ str); } }
  • 12.  String Handling concept is storing the string data in the main memory (RAM), manipulating the data of the String, retrieving the part of the String etc. String Handling provides a lot of concepts that can be performed on a string such as concatenation of string, comparison of string, find sub string etc.
  • 13.  StringBuffer is a peer class of String that provides much of the functionality of strings. String represents fixed-length, immutable character sequences while StringBuffer represents growable and writable character sequences.
  • 14.  StringBuffer may have characters and substrings inserted in the middle or appended to the end. It will automatically grow to make room for such additions and often has more characters preallocated than are actually needed, to allow room for growth.
  • 15. String Buffer Constructors:  String Buffer()  String Buffer(int size)  String Buffer(String str)  String Buffer(CharSequence chars)
  • 16. StringBuffer Constructors: StringBuffer( ): It reserves room for 16 characters without reallocation. StringBuffer s=new StringBuffer(); StringBuffer( int size): It accepts an integer argument that explicitly sets the size of the buffer. StringBuffer s=new StringBuffer(20);
  • 17. StringBuffer(String str):  It accepts a String argument that sets the initial contents of the StringBuffer object and reserves room for 16 more characters without reallocation.  StringBuffer s = newStringBuffer("GeeksforGeeks");
  • 18.  Methods: Some of the most used methods are: length( ) and capacity( ): The length of a StringBuffer can be found by the length( ) method, while the total allocated capacity() methord.  int length()  int capacity()
  • 19. append( ): It is used to add text at the end of the existence text. Here are a few of its forms:  StringBuffer append(String str)  StringBuffer append(int num) . insert( ): It is used to insert text at the specified index position. These are a few of its forms:  StringBuffer insert(int index, String str)  StringBuffer insert(int index, char ch)
  • 20.  delete( ) and deleteCharAt( ): o It can delete characters within a StringBuffer by using the methods delete( ) and deleteCharAt( ). o The delete( ) method deletes a sequence of characters from the invoking object. o The deleteCharAt( ) method deletes the character at the index specified by loc.  StringBuffer delete(int startIndex, int endIndex)  StringBuffer deleteCharAt(int loc)
  • 21.  replace( ): It can replace one set of characters with another set inside a StringBuffer object by calling replace( ). The substring being replaced is specified by the indexes start Index and endIndex.  StringBuffer replace(int startIndex, int endIndex, String str)
  • 22.  ensureCapacity( ): It is used to increase the capacity of a StringBuffer object. The new capacity will be set to either the value we specify or twice the current capacity plus two (i.e. capacity+2), whichever is larger. Here, capacity specifies the size of the buffer.  void ensureCapacity(int capacity)
  • 23. getchars(): To copy of a substring of a stringbuffer into a array, use the getchars() method().Sourcestart specifies the index of the beginning of the substring, and source end specifies an index of the end substring.  Void getchars(int souceStart, int sourceEnd, char target[], int targetstart)
  • 24.  reverse(): You can reverse the characters within string buffer object using reverse().  String buffer reverse()  substring(): You can obtain a portion of a string buffer by calling substring().  String substring(int starIndex)  String substring(int startIndex, int endIndex)
  • 25.  J2SE 5 adds a new string class to Java’s already powerful string handling capabilities. This new class is called String Builder.  It is identical to String Buffer except for one important difference: it is not synchronized, which means that it is not thread-safe.  The advantage of String Builder is faster performance. However, in cases in which you are using multithreading, you must use String Buffer rather than String Builder.