java super কিওয়ার্ড ব্যবহার করা হয় parent class এর object .
super কিওয়ার্ড ব্যবহার:
super is used to refer immediate parent class instance variable.
super() is used to invoke immediate parent class constructor.
super is used to invoke immediate parent class method.
super is used to refer immediate parent class instance variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
super() is used to invoke immediate parent class constructor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
super is used to invoke immediate parent class method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
জাভায় final কিওয়ার্ডটি বিভিন্ন contexts এ ব্যবহার করা হয়। জাভায় final কিওয়ার্ড ব্যবহারে সীমাবদ্ধ করে দেয় একজন ব্যবহারকারিকে । final হতে পারে।
১. Variable
২. Method
৩. Class
১. final Variable: একটি final variable একবারই assign করা হয়। যদি final variable টি একবার রেফারেন্স করে দেওয়া হয় তাহলে অন্য কোন object দিয়ে পুনরায় ঐ variable কে re-bound হতে পারে না।
উদাহরণ দেখা যাকঃ-
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
বিঃদ্রঃ c++ const variable এবং জাভা final variable এর মধ্যে পার্থক্য আছে। সি ++ const variable যখন ডিক্লার করা হয় তখনই assign করে দিতে হয়। কিন্তু জাভার ক্ষেত্রে final variable assign প্রথমে না করলে হবে এটার প্রয়োজন নাই। তবে পরবর্তীতে assign করা যায়। অব্যশই একবার assign করতে হবে।
নিচের উদাহরণটি লক্ষ্য করা যাকঃ-
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Final Mehod: একটি final method কে subclass দ্বারা overridden করতে পারা যায় না।
আমারা যদি subclass দ্বারা final method কে overridden করতে যায় সেক্ষেত্রে ভুল গুলো নিচের প্রোগ্রামে লক্ষ্য করি।
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Final class: final class কে সম্প্রাসারিত (inherited)করতে পারা যায় না।
নিচের প্রোগ্রামটি লক্ষ্য করিঃ-
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JVM(Java Virtual Machine) acts as a run-time engine to run Java applications. JVM is the one that actually calls the main method present in a java code. JVM is a part of JRE(Java Run Environment).
Java applications are called WORA (Write Once Run Everywhere). This means a programmer can develop Java code on one system and can expect it to run on any other Java enabled system without any adjustment. This is all possible because of JVM.
When we compile a .java file, a .class file(contains byte-code) with the same filename is generated by the Java compiler. This .class file goes into various steps when we run it. These steps together describe the whole JVM.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters