what is instance variable in Java?
Answers
Answered by
4
Answer:
An instance variable is a variable which is declared in a class but outside of constructors, methods, or blocks. Instance variables are created when an object is instantiated, and are accessible to all the constructors, methods, or blocks in the class. Access modifiers can be given to the instance variable.
this will help you
please do follow me
Answered by
2
Explanation:
•__________________________________•
ᴀɴ ɪɴsᴛᴀɴᴄᴇ ᴠᴀʀɪᴀʙʟᴇ ɪs ᴀ ᴠᴀʀɪᴀʙʟᴇ ᴡʜɪᴄʜ ɪs ᴅᴇᴄʟᴀʀᴇᴅ ɪɴ ᴀ ᴄʟᴀss ʙᴜᴛ ᴏᴜᴛsɪᴅᴇ ᴏғ ᴄᴏɴsᴛʀᴜᴄᴛᴏʀs,ᴍᴇᴛʜᴏᴅ ᴏʀ ʙʟᴏᴄᴋs ɪɴsᴛᴀɴᴄᴇ ᴠᴀʀɪᴀʙʟᴇ ᴀʀᴇ ᴀᴄᴄᴇssɪʙʟᴇ ᴛᴏ ᴀʟʟ ᴛʜᴇ ᴄᴏɴsᴛʀᴜᴄᴛɪᴏɴ ᴍᴇᴛʜᴏᴅ ᴏʀ ʙʟᴏᴄᴋs ɪɴ ᴛʜᴇ ᴄʟᴀss
•__________________________________•
ᴍᴀʀᴋ ᴍᴇ ᴀs ʙʀᴀɪɴʟɪsᴛ❤
Similar questions