G-8 ch-5 Introduction to Java and BlueJ
G-8 ch-5 Introduction to Java and BlueJ
Fill in the
5. The Java programming language is an Object Oriented
Programming language.
6. Encapsulation is the technique of binding both data and functions
together.
7.A Class is a blueprint that defines data and functions common to all
objects of a certain kind.
8. Initialization is a process of assigning some initial value to a
variable.
9.
Class Object
1. Class is the blueprint of an Object is an instance of a class.
object. It is used to declare and
create objects.
2. No memory is allocated when Memory is allocated as soon as an
a class is declared. object is created.
3. A class is a group of similar Object is a real-world entity such as
objects a book, car, etc.
.
4. Class can only be declared Objects can be created many times
once. as per requirement.
5. Examples of class can be cars. Objects of the class car can be
BMW, Mercedes, jaguar, etc.
4. What is an identifier?
Ans : Identifiers in Java are the name of variables, methods, classes,
packages and interfaces.They represent names of different components of a
java program.
5. What are keywords? State the difference between keywords
and identifiers.
Ans: Keywords are the predefined and specific reserved words, which hold
special meaning.
Keyword Identifire
7. Define objects. Give a real life example to explain objects along
with their attributes and behaviour.
Ans : An object represents data (attributes) and its related methods
(behaviour) as a single unit. Take the example of a car. When we
describe a car as an object, there are a number of physical factors
which contribute to define its state such as its brand name, colour,
speed, size, number of seats, etc. In addition, the car has several
functional definitions. It transports people to different locations by
controlling its speed and direction, an accelerator to increase or
decrease its speed and brakes to stop it. Thus we can say that car
is an object that combines its attributes and behaviour as a single
unit.
Ans:Keywords are reserved words that have a special meaning for the
Java compiler. Java compiler reserves these words for its own use so
Keywords cannot be used as identifiers. For example, void, public, class,
int, etc.
12. What are variables? How are they different from Constants?
Ans: A variable is a named location in the memory which stores data
temporarily. A variable has a unique name, a type and a size that is used
to identify it in a program.
👇
Write these two programs in BlueJ editor ,compile it and execute it
and write the output in the given space.