Method |
Description |
Return Type |
length() |
returns the length of a specified string. दिए गए शब्द या वाक्य की लेंथ बताता है। Example:- String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; System.out.println(txt.length()); //26 |
String |
toUpperCase() |
Converts a string to upper case letters शब्द या वाक्य के स्माल लेटर्स को कैपीटल लेटर में बदल देता है। Example:- String s="Sachin"; System.out.println(s.toUpperCase());//SACHIN |
String |
trim() |
Removes whitespace from both ends of a string यह शब्द या वाक्य में से आगे और पीछे गैरजरूरी स्पेस को हटा देता है। Example:- String myStr = " Hello World! "; System.out.println(myStr); // Hello World! System.out.println(myStr.trim());//Hello World! |
String |
|
appends (concatenate) a string to the end of another string. दो शब्दों या वाक्यों को जोडने के लिए प्रयोग किया जाता है। Example:- String firstName = "John "; String lastName = "Doe"; System.out.println(firstName.concat(lastName)); // John Doe |
String |
Saturday, 30 April 2022
Question : - Describe the usage of any four methods in string class in Java. जावा में स्ट्रिंग क्लास के किन्हीं चार मैथडों के बारे में बताइए।
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment