0% found this document useful (0 votes)
3 views15 pages

Java 12 Mark Answers

The document outlines key concepts of Java programming, including OOP principles, operators, features, data types, classes, constructors, method overloading and overriding, arrays, strings, threads, exception handling, file streams, AWT for GUI applications, and object streams. Each section provides definitions and conclusions emphasizing the importance of these concepts in Java. Overall, it serves as a comprehensive guide for understanding Java fundamentals.

Uploaded by

tejasnag247
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)
3 views15 pages

Java 12 Mark Answers

The document outlines key concepts of Java programming, including OOP principles, operators, features, data types, classes, constructors, method overloading and overriding, arrays, strings, threads, exception handling, file streams, AWT for GUI applications, and object streams. Each section provides definitions and conclusions emphasizing the importance of these concepts in Java. Overall, it serves as a comprehensive guide for understanding Java fundamentals.

Uploaded by

tejasnag247
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

JAVA – 12 MARK EXAM ANSWERS

1. OOP Principles

Object-Oriented Programming uses objects and classes.

Encapsulation: Data hiding using private variables.

Inheritance: One class acquires another class properties.

Polymorphism: One method behaves differently.

Abstraction: Hiding implementation details.

Conclusion: Makes programs reusable and secure.


2. Java Operators

Operators perform operations on variables.

Types: Arithmetic, Relational, Logical, Assignment, Unary, Bitwise, Ternary.

Arithmetic: +, -, *, /, %

Relational: ==, >, <

Logical: &&, ||, !

Conclusion: Used for calculations and decisions.


3. Features of Java

Java is simple and easy to learn.

Object-Oriented and platform independent.

Secure and robust.

Supports multithreading.

Portable and high performance.

Conclusion: Widely used for applications.


4. Data Types

Data types define type of data.

Primitive: int, float, char, boolean.

Non-Primitive: String, Array, Class.

Primitive stores values.

Non-primitive stores references.

Conclusion: Used for memory management.


5. Class and Object

Class is a blueprint.

Object is an instance of class.

Class contains variables and methods.

Object uses class features.

Conclusion: Core of Java programming.


6. Constructors

Constructor initializes objects.

Types: Default, Parameterized, Copy.

Parameterized constructor passes values.

Called automatically when object is created.

Conclusion: Helps initialize objects efficiently.


7. Method Overloading

Same method name with different parameters.

Achieved by changing number/type/order.

Compile-time polymorphism.

Improves readability.

Conclusion: Flexible method usage.


8. Method Overriding

Same method in parent and child class.

Runtime polymorphism.

Method decided at runtime.

Conclusion: Dynamic behavior.


9. Arrays

Array stores multiple values.

1D: Single row.

2D: Rows and columns.

Conclusion: Efficient data storage.


10. Strings

String is sequence of characters.

Immutable in Java.

Methods: length(), charAt(), toUpperCase().

Conclusion: Used for text handling.


11. Threads

Thread is lightweight process.

States: New, Runnable, Running, Waiting, Terminated.

Used for multitasking.

Conclusion: Improves performance.


12. Exception Handling

Handles runtime errors.

Keywords: try, catch, finally.

Prevents program crash.

Conclusion: Improves reliability.


13. File Streams

FileInputStream reads data.

FileOutputStream writes data.

Works with binary data.

Conclusion: Used for file handling.


14. AWT

Used for GUI applications.

Components: Button, Frame, Label.

Hierarchy: Component → Container → Frame.

Conclusion: Used for UI design.


15. Object Streams

Used for storing objects.

Serialization and Deserialization.

Classes: ObjectInputStream, ObjectOutputStream.

Conclusion: Object persistence.

You might also like