0% found this document useful (0 votes)
9 views4 pages

Java Notebook Exam

The document is a Java exam creative notebook containing various sections including 1-mark questions, comparisons between FileReader and FileWriter, and an example program demonstrating inheritance using the super keyword. Key concepts covered include the final keyword, the javap tool, array declaration, the Object class, and GUI components in Swing. It provides concise answers and examples relevant to Java programming.

Uploaded by

OM YADAV
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)
9 views4 pages

Java Notebook Exam

The document is a Java exam creative notebook containing various sections including 1-mark questions, comparisons between FileReader and FileWriter, and an example program demonstrating inheritance using the super keyword. Key concepts covered include the final keyword, the javap tool, array declaration, the Object class, and GUI components in Swing. It provides concise answers and examples relevant to Java programming.

Uploaded by

OM YADAV
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 Exam Creative Notebook

Complete Q&A; • MCQs • Diagrams • University & Company Questions


■ Section 1: 1-Mark Questions
Q. What is the purpose of the final keyword when applied to
variables?
➡■ It makes the variable constant (value cannot be changed once assigned).

Q. What is the purpose of the javap tool in Java?


➡■ It is a disassembler tool that shows bytecode and method/field details of compiled
.class files.

Q. How is a 1D array declared in Java?


➡■ Syntax: int arr[] = new int[5];

Q. What is the Object class in Java?


➡■ It is the parent (superclass) of all classes in Java. Every class directly or indirectly
inherits it.

Q. Name any two GUI components used in Swing.


➡■ JButton, JTextField
■ FileReader vs FileWriter
FileReader FileWriter

Reads data from files. Writes data to files.


Character-based input. Character-based output.
Returns int (character code). Writes single char/array/string.
Example: FileReader fr=new FileReader("[Link]"); Example: FileWriter fw=new FileWriter("[Link]");
■ Example Program: Inheritance with super Keyword
class Animal { Animal() { [Link]("Animal created"); }
} class Dog extends Animal { Dog() { super(); // Calls parent
constructor [Link]("Dog created"); } } public class
Test { public static void main(String[] args) { Dog d = new Dog();
} }

You might also like