Lesson 18 of 34

Methods: পুনরায় ব্যবহারযোগ্য কোড

9 min 25 XP

Method হলো নাম দেওয়া কোডের block: একবার লিখুন, বহুবার call করুন। আপাতত আমরা main()-এর পাশে static methods লিখব। Parameters values ভেতরে পাঠায়।

Example: edit me and press Run

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

void মানে method কোনো value ফেরত দেয় না। পরের lesson: value ফেরত দেওয়া methods।

Challenge

+25 XP

একটি method printBox(String text) লিখুন যা print করে: [ text ] main()-এ input-এর একটি লাইন পড়ে তা দিয়ে printBox call করুন। Input: Hello Output: [ Hello ]

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