हिंदी

Differentiate between charAt() and substring(). - Computer Applications

Advertisements
Advertisements

प्रश्न

Differentiate between charAt() and substring().

अंतर स्पष्ट करें

उत्तर

S. No. charAt() substring()
1. Returns a character in the String at the nth place, counting from the 0th position. This function extracts a set of characters from a specified index up to the end of a string.
2.

Example:

a = "computer";
System.out.println(a.char At(5)); 

Example:

Strings = "ThanksBspAcp";
System.out.println(s.substring(6));
3. In the above example, t is printed. In the above example, BspAcp is printed.
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 4: String Handling - EXERCISES [पृष्ठ २८९]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
अध्याय 4 String Handling
EXERCISES | Q VI. 4. | पृष्ठ २८९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×