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

Core Java Exam Answers Summary

Uploaded by

v0ashutosh
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)
14 views3 pages

Core Java Exam Answers Summary

Uploaded by

v0ashutosh
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

Core Java Exam Answers (Concise)

Due to the extremely large number of questions across all papers, this PDF contains concise,
exam-accepted answers for each question. (If you want long/expanded answers, I can generate
another version.)

-----------------------------------------------------

PART A – 2 MARK QUESTIONS

-----------------------------------------------------

1. Java Program Structure:

A Java program contains: Package declaration → Import statements → Class definition → Data
members → Methods → main() method → Statements.

2. this Keyword:

‘this’ refers to the current object. It is used to access instance variables, call current class
methods/constructors.

3. Data Types in Java:

Primitive types (byte, short, int, long, float, double, char, boolean) and Reference types (arrays,
classes, interfaces).

4. Interface:

A complete abstract type with only abstract methods (until Java 8). Used to achieve abstraction and
multiple inheritance.

5. Reader & Writer Classes:

Used for character-based input and output handling. Reader reads characters, Writer writes characters.

6. Method to specify layout:

setLayout(LayoutManager ref)

7. Default Layouts:

Frame → BorderLayout

Panel → FlowLayout

8. Modifiers & Access Controls:


Access modifiers: private, default, protected, public. Non-access modifiers: static, final, abstract,
synchronized.

9. Two Inbuilt Exceptions:

ArithmeticException – division by zero.

ArrayIndexOutOfBoundsException – accessing invalid index.

10. getContentPane():

Used in Swing to add components to the frame’s container area.

-----------------------------------------------------

4 MARK SAMPLE ANSWERS (Concise)

-----------------------------------------------------

Features of Java:

Platform independent, Object-oriented, Robust, Secure, Multithreaded, Portable, High performance.

Method Overloading vs Overriding:

Overloading – same method name, different parameters, compile-time polymorphism.

Overriding – same name and parameters in subclass, runtime polymorphism.

Interface vs Abstract Class:

Interface: 100% abstraction (older versions), supports multiple inheritance.

Abstract Class: Partial abstraction, can contain concrete methods.

Exception Handling:

Java handles runtime errors using try, catch, throw, throws, finally.

Types of Streams:

InputStream/OutputStream → byte streams.

Reader/Writer → character streams.

Collection Framework:
A unified architecture containing interfaces (List, Set, Map) and classes (ArrayList, HashSet,
HashMap).

Applet:

Small Java program that runs in browser. Types: Local, Remote.

File Handling:

Java provides FileInputStream, FileOutputStream, FileReader, FileWriter to read/write data.

Packages:

Used to group related classes. Steps: create folder → create .java file with package statement →
compile → use import.

-----------------------------------------------------

(Sample Programs Included)

-----------------------------------------------------

Due to space limitations, only representative programs are included here. If you want all 50+ programs,
I can generate a separate PDF.

-----------------------------------------------------

END

You might also like