1/10
Flashcards covering the key concepts of classes and objects in Object Oriented Programming.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is a class in Object Oriented Programming?
A class is a template used to create objects.
What is an object in Object Oriented Programming?
An object is any entity that has a state (properties) and behavior (methods).
How are classes and objects related?
Classes are categories, and objects are items within each category.
What are the basic concepts of Object Oriented Programming?
Classes and Objects that revolve around real life entities.
What is the syntax to create a class?
class ClassName { // properties // methods }
Provide an example of a class definition.
class Fruit { String color; String taste; }
How do you create an object in Java?
You can create an object using the syntax: Fruit Mango = new Fruit();
How do you assign properties to an object?
You can assign properties like this: Mango.color = 'Yellow'; Mango.taste = 'Sweet';
What is a method?
A method is a state of behavior and a program module that contains a series of statements to carry out a task.
What is the syntax to create a method in a class?
public int add(int a, int b) { return a + b; }
How do you call a method from a class?
You can call a method like this: int result = util.add(5, 3);