0% found this document useful (0 votes)
4 views

Chap-5

Chapter 5 covers the fundamentals of programming, focusing on Object-Oriented Programming (OOP) features such as encapsulation, abstraction, inheritance, and polymorphism. It also explains data types in Java, including primitive and non-primitive types, as well as concepts like bytecode, classes, objects, keywords, identifiers, literals, variables, and operators. The chapter provides a comprehensive overview of essential programming concepts and their applications in Java.

Uploaded by

Rohan Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Chap-5

Chapter 5 covers the fundamentals of programming, focusing on Object-Oriented Programming (OOP) features such as encapsulation, abstraction, inheritance, and polymorphism. It also explains data types in Java, including primitive and non-primitive types, as well as concepts like bytecode, classes, objects, keywords, identifiers, literals, variables, and operators. The chapter provides a comprehensive overview of essential programming concepts and their applications in Java.

Uploaded by

Rohan Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Chapter-5

Fundamentals of Programming

Qs. Explain the main features of OOP.


The main 4 features of OOP are:
a) Encapsulation – Encapsulation is an important feature of OOP, which is a process
of wrapping up of data and methods into a single unit called class. Encapsulation
hides the irrelevant details of an object. It makes the classes independent.
b) Abstraction – Abstraction is an important feature of OOP, which is a process of
representing the essential features of an object without including the background
details and explanations.
c) Inheritance – Inheritance is an important feature of OOP, which is a process of
creating a new class (sub/derived class) from an existing class (super/base class).
The new class inherits the attributes and behaviours of the existing class and
extends the functionality of that class.
d) Polymorphism – Polymorphism is an important feature of OOP, which is a process
of defining multiple methods with the same name but different parameters. They
behave differently, depending on what they are operating on.

Qs. What is data type? Describe the different data types used in Java.
The data stored in the memory of a computer can be of different types. Data type
represents the kind of data and determines how much memory the data requires and
what kind of operations can be performed on the data. The various data types in Java
are:
e) Primitive Types - The fundamental or basic data types, which are independent of
any other type, are called Primitive data types. In Java the eight predefined
primitive data types are byte, short, int, long, float, double, char, & boolean.
f) Non-Primitive Type - The data types which derived from one or more primitive
data types and have more functions than primitive data types are called Non-
primitive data types. In Java the various Non-primitive data types are class,
array, interface etc.

Qs. What is Bytecode?


Bytecode is an intermediate code generated by java compiler (javac) after compiling the
java source-code program written in java language. This Byte-code is a machine
independent code, which can run on any machine in which a JVM has been installed. It is
a compiled Java program file with .class extension.

Qs. What is Class?


A Class is a blueprint or prototype that is used to create objects. It is a conceptual
representation of all the entities that share common properties and behaviors.

1
Qs. What is Object?
Object is an instance of a Class. It is an identifiable entity with some characteristics
and behaviours. It combines data and methods into a single unit.

Qs. What is a Keyword?


Keywords are the reserved words in Java, which express the language features.
Keywords specify a particular task in a program and cannot be used as an identifier in
the program. Keywords are always written in lowercase.
E.g.- class , int , public , if etc.

Qs. What is Identifier?


Identifiers are the names of different program elements. They represent variable,
method, class, object, array, etc. They must start with a letter or underscore, or dollar
sign and can contain any set of letters, digits, dollar signs & underscores. It does not
contain any embedded space.

Qs. What is Literal?


Literals, also referred as constants, are the fixed values (data items), that do not
change during the execution of the program and remain constant within a program.
Literals are the values to be stored in variables. Different types of literals used in Java
are Integer, Floating Point / Real, Character, String, and Boolean.

Qs. What is Variable?


Variable is a temporary reserved memory area that can store different values during
the program execution. It is a named memory location, which holds a data value of a
particular data type. A variable has a name and specific data type.
Declaration Syntax: DataType VariableName = Value;

Qs. What is Operator?


Operators are the special symbols, that used to perform some operations on data in a
program. Operators can be of three types, Unary, Binary and Ternary. In Java different
operators are Arithmetic operators, Relational operators, Logical operators,
Assignment operators, Increment-Decrement operators, and so on.
Arithmetic Operators :- + , - , * , / , %
Relational Operators :- == , != , > , >= , < , <=
Logical Operators :- ! , && , ||
Assignment Operators :- = , += , -= , *= , /= , %=
Increment & Decrement Operators :- ++ , --

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy