0% found this document useful (0 votes)
2 views3 pages

Intro To Java

The document outlines the differences between Procedural Oriented Programming (POP) and Object-Oriented Programming (OOP), highlighting key concepts such as data abstraction, inheritance, encapsulation, and polymorphism. It also discusses the advantages of encapsulation, types of Java programs, the Java compilation process, and features of Java. Additionally, it differentiates between compilers and interpreters, lists Java reserved words, describes types of inputs in Java, and defines a compound statement.

Uploaded by

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

Intro To Java

The document outlines the differences between Procedural Oriented Programming (POP) and Object-Oriented Programming (OOP), highlighting key concepts such as data abstraction, inheritance, encapsulation, and polymorphism. It also discusses the advantages of encapsulation, types of Java programs, the Java compilation process, and features of Java. Additionally, it differentiates between compilers and interpreters, lists Java reserved words, describes types of inputs in Java, and defines a compound statement.

Uploaded by

rgupta0706
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Q.1) Difference between POP and OOP.

Procedural Oriented Programming Object-Oriented Programming


In POP, the program is divided into small parts In OOP, the program is divided into small parts
called functions called objects
The program follows a top-down approach The program follows a bottom-up approach
It is less secure It is more secure
It is based on the unreal world It is based on the real world
Egs: C, FORTRAN, Pascal Egs: C++, Java, Python

Q.2) Name the 4 principles of OOP? Define them.

a) Data Abstraction – Data Abstraction means hiding unnecessary information and displaying
necessary information. It hides its complexities and operations.

b) Inheritance – Inheritance is a fundamental OOP concept that allows a class to inherit the
properties and behaviours of the parent class. Need it for Code Reusability.

c) Encapsulation – Encapsulation is the wrapping up of the data under a single unit called a class. It is
the way of hiding its implementation details from outside access.

d) Polymorphism – Polymorphism is the ability of a message to be displayed in more than one form.
It allows us to perform a single action in different ways.

Q.3) What are the advantages of Encapsulation?

1. Flexible Programs
2. Easy debugging and testing
3. Reusability
4. Data Hiding

Q.4) Name the 2 types of Java programs and define them.

1. Java Applet – Java applet is an internet-based application software. Needs a web browser

Eg: Animated GIF’s

2. Java Application – Java application is a standalone program to accomplish a task. Works


without a browser.

Eg: Mobile applications

Q.5) Java uses both compiler as well as Interpreter. (Java compilation process)

Java converts source code to intermediate code called as Java byte code which is platform-
independent. It is then converted into machine code, also called object code, with a special
interpreter called JVM (Java virtual machine)

Q.6) Fill in the blanks.

a) A Java class file has .class filename extension.


b) A Java file contains Java bytecode that can be executed on the Java Virtual Machine (JVM).

c) Java source file has .java filename extension.

d) Data hiding is a way of restricting the access.

Q.7) What are the features of Java?

 Object-oriented programming
 Simple coding
 Write once, run anywhere (WORA)
 Platform Independent
 Portable
 User-friendly

Q.8) Differentiate between Compiler and Interpreter

Compiler Interpreter
Conversion of source Conversion of source
code to machine(object) code to machine(object)
code all at once code line by line

Compiler is faster but Interpreter takes time


difficult to debug the but solves it line by line
program as all errors are
shown together

Eg: FORTRAN Eg: UNIX, WINDOWS 8,


OS

Q.9) What are Java reserved words?


Java reserved words, also called as keywords, carry special meaning to the system compiler.
Eg: [Link], [Link]

Q.10) 3 types of Inputs in Java?


•Hard Coded value eg int a=5;
•Function Arguments eg void main(int a)
•Scanner Inputs eg int a=[Link]();

Q.11) What is a compound statement?

A compound statement is a statement which encloses a number of statements within a


block of opening and closing curly braces.

Q.12) Difference between Static and Dynamic Initialisation.

You might also like