Object-Oriented Programming in Java

32 cards   |   Total Attempts: 194
  

Cards In This Set

Front Back
A ___________ is a template for multiple objects with similar features and it is a blueprint for objects.
Class
A _______________ is a special type of method that determines how an object is initialized when it is created.
Constructor
An ____________ is an instance of a class and it is a software unit that combines a structured set of data with a set of operations for inspecting and manipulating that data
Object
The default visibility modifier for class methods and instance variables is _______________ .
Protected
___________________, also called information hiding, is the packing of data and functions into a single component and keeps both safe from outside interference and misuse.
Encapsulation
What are the 4 different visibility modifiers?
Public, package-private, private, protected
A _____________ instance variable can only be accessed and used within the class in which it is declared.
Private
__________________ is where two methods in a class have the same method name with different parameters/arguments.
Method overloading
If the name of your Java class is Banana, what is the name of your constructor?
Banana
__________ and _________ are methods that are used to retrieve and modify private instance variables.
Getters (aka accessors), Setters (aka mutators)
True or False? If you create a constructor in a class, Java will create the default, no-arg constructor for you.
False. If you have not created a constructor, Java will create one for you. However, if you created a constructor (it doesn't matter which if it is the default or not), Java will not create one for you.
The _______ keyword is used to refer to the current object.
This
A ___________ instance variable can be access from any other class or classes in different packages.
Public
A _________ instance variable can only be accessed in classes that live in the same package.
Protected
What are the differences between a constructor and a method?
Constructors do not have return types. Constructors must have the same name of the class. A constructor will be automatically invoked when an object is created, whereas method has to be called explicitly using the dot operator.