import java.io.*;
public class First100Chars {
/**
* This method Obtain the first 100 characters of a string.
* @param str String to obtain the first 100 characters.
* @return String Obtains the first 100 characters of a string.
*/
public String first100Chars(String str) {
//Variable to store the first 100 characters
String first100 = "";
//Obtain the first 100 characters of the string
first100 = str.substring(0, 100);
//Return the first 100 characters of the string
return first100;
}
/**
* One Example
*/
public static void main(String args[]) throws IOException {
First100Chars first100Chars= new First100Chars ();
//Example
String str = "This is a string";
String first100 = first100Chars.first100Chars(str);
//Output
System.out.println("First 100 characters of the string is :" + first100); //This is a string
}
}
For further actions, you may consider blocking this person and/or reporting abuse
Oldest comments (0)