Lesson 5 of 34

Strings নিয়ে কাজ

9 min 20 XP

Strings-এর সঙ্গে অনেক দরকারি methods আসে। length() দৈর্ঘ্য দেয়। charAt(i) অবস্থান i-এর অক্ষর দেয়, গোনা শুরু 0 থেকে। substring(a, b) a থেকে b পর্যন্ত অংশ দেয় (b বাদে)।

Example: edit me and press Run

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.

Strings কখনো == দিয়ে তুলনা করবেন না; equals() ব্যবহার করুন। Capital letters না দেখে তুলনার জন্য equalsIgnoreCase()। এটি interview-এর প্রিয় প্রশ্ন!

Example: edit me and press Run

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.

Strings immutable: toUpperCase()-এর মতো methods নতুন String ফেরত দেয়, মূলটি বদলায় না।

Challenge

+20 XP

একটি শব্দ পড়ে তার প্রথম অক্ষর, শেষ অক্ষর এবং দৈর্ঘ্য print করুন। Input: Chennai Output: First: C Last: i Length: 7

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.