0% found this document useful (0 votes)
11 views1 page

191-33P - Programming Lab Java-Algorithm - String Extraction

Uploaded by

shreegokul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

191-33P - Programming Lab Java-Algorithm - String Extraction

Uploaded by

shreegokul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Write a Java Applications to extract a portion of a character string and print the extracted
string.

Aim: Extracting a portion of a character string and print the extracted string.

Step No. Instructions


1 Start
2 Declare a string variable s1 to store a string received from keyboard
3 Declare another string variable s2 to store a set of extracted characters from string s1
4 Declare 2 integer variables namely, a and b to store the Starting Position and Ending
Position for Extraction
5 Read a string from keyboard using readLine( ) function
6 Convert the string into integer using parseInt( ) method and store it in the variable a
7 Read an another string from keyboard using readLine( ) function
8 Convert the string into integer using parseInt( ) method and store it in the variable b
9 Find the number of characters from a to b in s1 using substring( ) method of String
class and store them in s2
10 Print s2 using println( ) method
11 Save the Java code in the name of list1.java
12 Compile the Java code using javac
13 Run the Java code using java
14 Stop

You might also like