Assignment No.1
Assignment No.1
Block No: 07
1. In my point of view, a programmer’s primary tasks is to write and modify code to create software solutions.
2. Programming is the process of designing and building instructions for computers to execute specific tasks.
3. Object-Oriented Programming is a programming paradigm that organizes software design around objects and data rather than
4. OOP is applied to create modular, reusable, and maintainable code by encapsulating data within objects and defining
5. A class is a blueprint in creating objects, all code in a Java program must belong to a class. Classes define the types for objects;
hence, objects are sometimes referred to as instances of their defining class, because they take on the name of that class as their
6. Class names should start uppercase letter and follow CamelCase naming conventions.
7. The main “actors” in Java program are objects. Objects store data and provide methods for accessing and modifying this data.
Every object is an instance of a class, in which defines the type the object, as well as the kinds of operations that it performs.
8. A method is a function defined within a class to perform specific actions. Methods can accept parameters as arguments, and
their behavior depends on the object they belong to and the values of any parameters that are passed. Every method in Java is
specified in the body of some class. A method definition has two parts: the signature, which defines the and parameters for a
method, and the body, which defines what the method does. A method allows a programmer to send a message to an object.
The method signature specifies how such a message should look and the method body specifies what the object will do when it
receives such a message. We declare methods in Java by specifying the method signature within the class. The syntax in
// method body …
9. Method name should start with a lowercase letter and follow camelCase naming conventions.
10. A constructor is a special method used to initialize objects when they are created.
// constructor body …
11. Constructors have the same name as the class and do not have a return type.
12. Create a Java program that demonstrates the use of constructors and methods. The class should model a basic entity with
This program defines a class Entity with attributes name and age, a constructor to initialize these attributes, and a
method displayInfo to print the entity’s information. In the main method, an instance of Entity is created and its information
is displayed.