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

Java Short Answers

Uploaded by

boldiegaming2
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)
15 views3 pages

Java Short Answers

Uploaded by

boldiegaming2
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
You are on page 1/ 3

Short Answer Type Questions –

Answers
1. 1. What is procedure-oriented programming?

A programming paradigm based on the concept of procedures or routines, where the


program is divided into functions that operate on data.

2. 2. Define an object.

An object is an instance of a class that contains both data (attributes) and methods
(functions) to manipulate the data.

3. 3. Define a software object.

A software object is a self-contained unit consisting of data and procedures that operate on
the data, created from a class in OOP.

4. 4. What is object-oriented programming?

Object-Oriented Programming (OOP) is a paradigm that organizes software design around


objects, which are instances of classes.

5. 5. What is the difference between procedure-oriented programming and object-oriented


programming?

POP focuses on functions and procedures, while OOP focuses on objects and classes. OOP
provides better data security and reuse through encapsulation and inheritance.

6. 6. What is the use of data hiding?

Data hiding protects data from unauthorized access and ensures only essential details are
exposed, enhancing security and encapsulation.

7. 7. What is abstraction?

Abstraction is the process of hiding complex implementation details and showing only
essential features to the user.

8. 8. What is encapsulation?

Encapsulation is the concept of wrapping data and the methods that operate on the data
into a single unit (class), and restricting access to some of the object's components.

9. 9. What is the difference between abstraction and encapsulation?


Abstraction hides complexity by showing only essential information; encapsulation hides
the internal state and enforces access control.

10. 10. What is the benefit of encapsulation?

Encapsulation enhances security, modularity, and maintainability by restricting direct


access to some components.

11. 11. What is a function?

A function is a block of code that performs a specific task and can be reused throughout a
program.

12. 12. What is the role of a function in encapsulation?

Functions provide controlled access to data members of a class, supporting encapsulation


by defining how data is manipulated.

13. 13. What is OOP?

OOP (Object-Oriented Programming) is a programming model based on objects that


encapsulate data and behavior, promoting modular and reusable code.

14. 14. What are the elements of OOP?

The main elements are: Classes, Objects, Inheritance, Polymorphism, Abstraction, and
Encapsulation.

15. 15. What are the features of Java language?

Simple, Object-oriented, Platform-independent, Secure, Robust, Portable, High performance,


Multithreaded.

16. 16. What is Java Development Kit?

Java Development Kit (JDK) is a software development environment used to develop Java
applications and applets. It includes the Java Runtime Environment (JRE), compiler, and
tools.

17. 17. What is Java Virtual Machine?

JVM is a virtual machine that runs Java bytecode and provides a platform-independent
execution environment.

18. 18. What is BlueJ or Greenfoot?

BlueJ and Greenfoot are educational IDEs for learning Java. BlueJ is for general-purpose Java
development, while Greenfoot is designed for creating graphical simulations and games.

19. 19. What are the features of BlueJ or Greenfoot?


Simple interface, Easy-to-use for beginners, Interactive object creation, Visualization of
class structure, Support for object-oriented concepts.

20. 20. Write a brief program in BlueJ environment and compile it.

public class Hello {


public static void main(String[] args) {
System.out.println("Hello, BlueJ!");
}
}

21. 21. Write the steps of creating a class in BlueJ.

1. Open BlueJ
2. Create a new project
3. Click 'New Class'
4. Enter class name
5. Click OK to create the class

22. 22. Write the steps of running a program in BlueJ.

1. Compile the class


2. Right-click the class
3. Select 'void main(String[] args)'
4. Click OK to execute

23. 23. How can you create a JAR file?

In BlueJ: Go to Project>Create JAR File, select classes and settings, then click 'Continue' to
generate the JAR.

24. 24. Define the following in terms of Java:


(i) Robustness
(ii) Portability
(iii) JVM
(iv) Platform independent

(i) Robustness: Java has strong memory management and exception handling to create
reliable programs.
(ii) Portability: Java programs can run on any device with a JVM, making them portable.
(iii) JVM: Java Virtual Machine runs Java bytecode and provides a platform-independent
execution environment.
(iv) Platform Independent: Java code is compiled into bytecode which can be run on any
system with a JVM.

You might also like