World's only instant tutoring platform
Search questions and Textbooks
dropdown-logo
Filter Icon

Filters

Class 11 Sbi Examinations Questions asked by Filo students

Question 5
Views

Views: 6,042

char charAt(int position) In the above example, position is the index of the character which you want to extract. char a; "ritiprateek", charAt(3) In the above example, the value " " will be assigned to " ". getchars() The getChars( ) method returns more than one character at a time. getChars(int stringstart, int stringend, char target[ ], int targetStart) In the above usage, stringstart specifies the index of beginning of the substring. Whereas stringend specifies the index at the end of that substring. Therefore, the substring contains the total characters as stringstart through stringend-1. public class ExtractChar \{ public void main( ) \{ String str = "I am Poonam Mehta. " + "I read in O P ] Senior Model School," + "Fatehabad, Haryana"; int beginning ; int end = 17; char = new char [end - beginning]; str.getChars(beginning, end, ); System.out.println(a); Output of the Program Note Poonam Mehta The equals 0 method is used to check the getBytes() equivalence of the state of objects. converts the string into bytes according to specified character encoding and stores the result into a new array. This method is an alternative of getChars( ) method. Byte[ ] getBytes() Qilustration public class ByteChar \{ public void main() \{ String str = "I am Poonam Mehta." + "I read in O P J Senior Model School," + "Fatehabad, Haryana"; int beginning ; int end ; char a[] = new char [end - beginning]; (B6B) CANDID ICSE COMPUTER APPLICATIONS-10
Clear concepts with Filo App

Found the solution, but did not understand the concept?

Connect with a tutor in less than 60 seconds 24x7

Ask my first question

Get instant study help from an expert tutor 24/7
Download Filo