CodeGym/Java Course/মডিউল 2: জাভা কোর/স্তরের জন্য অতিরিক্ত পাঠ

স্তরের জন্য অতিরিক্ত পাঠ

বিদ্যমান

জাভাতে জেনেরিক কি?

এই পাঠে , আমরা জেনেরিক সম্পর্কে কথা বলব। বা বরং, জেনেরিকের মধ্যে ডুব দেওয়ার সময় আপনাকে যে মৌলিক বিষয়গুলি জানতে হবে: জেনেরিকগুলি কী এবং কেন আপনার সেগুলি আদৌ প্রয়োজন৷ বিষয়টি খুবই গুরুত্বপূর্ণ, এবং আপনাকে অবশ্যই এটি বুঝতে হবে। ফরোয়ার্ড !

বিড়ালদের জন্য জেনেরিক

টাইপ নিরাপত্তা এবং নমনীয়তার জন্য কম্পাইলারকে অতিরিক্ত তথ্য ইঙ্গিত করতে ডেভেলপারদের সাহায্য করার জন্য জেনেরিক্স একটি দুর্দান্ত সরঞ্জাম। এই গভীর নিবন্ধটি , কোডজিম সম্প্রদায়ের একজন সদস্য দ্বারা লিখিত, "জেনারিকস" এর চারপাশে আরেকটি ল্যাপ নেয়।

ইরেজার টাইপ করুন

এই পাঠটি জেনেরিকের কিছু বৈশিষ্ট্যের সাথে সাথে তাদের সাথে কাজ করার সময় উদ্ভূত সমস্যাগুলির জন্য উত্সর্গীকৃত। যেহেতু ভাষাটি তৈরি করার সময় জেনেরিকগুলি জাভার অংশ ছিল না, তাই টাইপ ইরেজার যোগ করা হয়েছে। ওটা কী? আমরা এটি সমাধান করব.

জেনেরিক মধ্যে ওয়াইল্ডকার্ড

ওয়াইল্ডকার্ডগুলি জেনেরিকের একটি অত্যন্ত গুরুত্বপূর্ণ বৈশিষ্ট্য এবং অবশ্যই একটি পৃথক পাঠের যোগ্য । এটি একটি আকর্ষণীয় এবং সহজ বিষয়। আপনি এটা পছন্দ করতে যাচ্ছেন :)

জেনেরিকের সাথে কাজ করার সময় varargs ব্যবহার করা

জেনেরিকের সাথে ভারার্গ ব্যবহার করলে বরং অপ্রীতিকর পরিণতি হতে পারে — গাদা দূষণ। এই পাঠে , আমরা জাভাতে জেনেরিকের বিভিন্ন বৈশিষ্ট্য নিয়ে আমাদের আলোচনা শেষ করি।

4
কাজ
Java Core,  লেভেল 5পাঠ 4
লক করা আছে
Something superfluous
Our program is once again full of unnecessary lines of code. Let's correct this blunder by removing all the extra methods, so that the program displays text (and only the text) that corresponds to the task conditions. By the way, you need to get used to this. Junior developers' special ability to create unnecessary code is pretty annoying to senior developers.
8
কাজ
Java Core,  লেভেল 5পাঠ 4
লক করা আছে
OOP: Method overloading
Let's display matrices in different ways, however we want. OOP gives us a wonderful tool for this: method overloading. Overload the printMatrix method in 8 different ways. You should end up with 10 different printMatrix methods.
4
কাজ
Java Core,  লেভেল 5পাঠ 4
লক করা আছে
OOP: Method overloading - Eliminating the superfluous
Not every overloaded method is useful. And so it is in this program. Look at the code and think about which implementation of the print method will be called. Then remove all the superfluous implementations of the method - and you're done.
4
কাজ
Java Core,  লেভেল 5পাঠ 4
লক করা আছে
Man or woman?
Something in this program isn't right... It seems to display the names of men, but not those of women. Put an end to the discrimination: change the printName method so that it runs for both man and woman. The method should have a single implementation.
4
কাজ
Java Core,  লেভেল 5পাঠ 4
লক করা আছে
Be gone, all that is unnecessary!
Again, we have extra lines in a program. They've resulted in a bug, because the program tries to call the add method for cases for which it is not implemented. We won't override the superfluous add methods this time. We'll do something simpler: delete the lines for which there is no implementation.
মন্তব্য
  • জনপ্রিয়
  • নতুন
  • পুরানো
মন্তব্য লেখার জন্য তোমাকে অবশ্যই সাইন ইন করতে হবে
এই পাতায় এখনও কোনো মন্তব্য নেই