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

Java Exam Notes: Key Topics & Questions

The document provides exam-oriented notes for a Java course, outlining key topics and high probability questions across various units including basics of Java, classes and objects, inheritance, exception handling, multithreading, I/O programming, collections, and networking. It also covers modeling concepts and lists repeated questions from past papers. The notes serve as a study guide for students preparing for the GTU 3153203 exam.

Uploaded by

Sujal Vaghela
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)
10 views4 pages

Java Exam Notes: Key Topics & Questions

The document provides exam-oriented notes for a Java course, outlining key topics and high probability questions across various units including basics of Java, classes and objects, inheritance, exception handling, multithreading, I/O programming, collections, and networking. It also covers modeling concepts and lists repeated questions from past papers. The notes serve as a study guide for students preparing for the GTU 3153203 exam.

Uploaded by

Sujal Vaghela
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 IMPORTANT EXAM-ORIENTED NOTES (GTU 3153203)

UNIT 1 – BASICS OF JAVA

Most Asked Topics:

- Features of Java

- JVM, JDK, Bytecode

- Data types, Operators, Control statements

- Arrays, String, StringBuffer, Wrapper classes

- Command line arguments

High Probability Questions:

- Explain features of Java

- Difference between JDK, JVM, JRE

- String vs StringBuffer

- Why Java is platform independent?

UNIT 2 – CLASSES, OBJECTS, METHODS

Most Asked Topics:

- Constructor & overloading

- Method overloading, Recursion

- this & static keyword

- finalize(), Inner & Anonymous classes

- Abstract class

High Probability Questions:

- Method Overloading vs Overriding

- Use of this keyword

- Static with example


UNIT 3 – INHERITANCE & INTERFACES

Most Asked Topics:

- Types of inheritance

- Multilevel inheritance & super

- final keyword

- Interfaces

- Dynamic Method Dispatch

- Abstract class vs Interface

High Probability Questions:

- Why Java does not support multiple inheritance?

- Dynamic method dispatch

- super keyword in constructor

UNIT 4 – PACKAGE & EXCEPTION HANDLING

Most Asked Topics:

- Packages, Import, static import

- try, catch, finally

- throw vs throws

- Custom exception

- Built-in exceptions

High Probability Questions:

- Difference: throw vs throws

- Custom exception program

UNIT 5 – MULTITHREADED PROGRAMMING

Most Asked Topics:


- Thread class & Runnable

- Life cycle of thread

- Synchronization, Deadlock

High Probability Questions:

- start() vs run()

- Deadlock example

UNIT 6 – I/O PROGRAMMING

Most Asked Topics:

- Byte vs Character streams

- FileInputStream, FileOutputStream

- FileReader, FileWriter

- BufferedReader

High Probability Topics:

- Program to copy file

- Difference between streams

UNIT 7 – COLLECTIONS & NETWORKING

Most Asked Topics:

- List, ArrayList, LinkedList

- Vector, Enumeration

- Properties

- InetAddress, Sockets, DatagramPacket

High Probability Topics:

- ArrayList vs LinkedList

- Vector & Enumeration


- InetAddress functions

UNIT 8 & 9 – MODELING

Most Asked Topics:

- UML concepts

- Class, State, Interaction models

- Aggregation, Composition

- Sequence diagram, Activity diagram

High Probability Questions:

- Difference between Aggregation vs Composition

- Draw Class diagram

- State diagram example

REPEATED QUESTIONS (ALL YEAR PAPERS):

- Quick Sort trace

- Binary Search + recurrence

- Master Theorem problems

- DFS/BFS + tree

- Matrix Chain Multiplication

- Huffman coding

- Knapsack (0/1 + Fractional)

- P–NP–NP Hard theory

- Naive string matching

- 4 Queens backtracking

Common questions

Powered by AI

In Java, 'throw' is used to explicitly throw an exception from a method or any block of code. It is typically used for custom exceptions. On the other hand, 'throws' is used in a method signature to declare that a method may potentially throw one or more specified exceptions. Understanding the distinction is critical for error management because 'throw' initiates an exception manually, while 'throws' alerts the caller of the method about potential exceptions it needs to handle or declare, promoting robust error handling strategies .

JDK (Java Development Kit) is a software development environment used for developing Java applications and applets. It includes a private JVM (Java Virtual Machine), a variety of development tools, debuggers, and libraries. JVM, on the other hand, is an engine that provides a runtime environment to execute Java bytecode. It is part of the JRE (Java Runtime Environment), which supplies libraries and other components that are necessary for running applications written in Java. The significance of these components lies in their ability to allow developers to write, compile, and run Java applications across different platforms without platform-specific modifications .

In Java, both abstract classes and interfaces are used to declare methods that subclasses must implement but are different in their usage and implementation. Abstract classes can include both abstract methods and concrete methods, allowing for some code reuse and complex class structures. Interfaces, however, can only contain method declarations (unless they include default or static methods, available from Java 8) and constants, suggesting a 'contract' of behaviors a class must implement. Abstract classes are appropriate when there's a shared base of functionality among classes, while interfaces are suited for defining capabilities shared across otherwise unrelated classes .

The 'this' keyword in Java is a reference variable that refers to the current object. It is used to avoid namespace collision that may occur when instance variables and parameters share the same name. By using 'this', constructors and methods can distinguish between class attributes and parameters with the same name. For instance, 'this.x = x;' assigns the parameter 'x' to the instance variable 'x' in a class. Employing 'this' enhances code readability and clarity in complex class hierarchies .

Dynamic method dispatch is a mechanism by which a call to an overridden method is resolved at runtime rather than compile-time. It is a crucial aspect of achieving runtime polymorphism in Java. When an overridden method is called through a superclass reference, Java determines which version of the method (superclass or subclass) to execute based on the actual object's type that the reference is pointing to at runtime. This enables Java to behave polymorphically, allowing one interface to point to a method in a class, leading to flexible and manageable code .

Java does not support multiple inheritance to prevent the complexity and ambiguity that arises from the 'diamond problem,' where a class inherits the same method from multiple sources. Instead, Java provides interfaces as a way to achieve similar functionality. A Java class can implement multiple interfaces, each of which can declare abstract methods without giving them any implementation. This allows a single class to inherit behaviors from multiple sources (interfaces) while avoiding the inherent problems associated with multiple inheritance .

Synchronization in Java is crucial in a multithreaded program to control the access of multiple threads to shared resources. Without synchronization, two or more concurrent threads could potentially modify shared resources, leading to inconsistent results, data corruption, or deadlocks where two threads wait indefinitely for each other to release resources. Proper synchronization ensures that only one thread accesses a critical section of code at a time, maintaining data integrity and consistency during execution .

In Java, the 'static' keyword denotes that the particular member belongs to a type itself rather than to an instance of that type. This means that static members are shared between all instances of a class. When a member is declared static, it is allocated memory once at the time of class loading, which means the memory isn't continually consumed as objects are instantiated. This impacts the program's memory allocation by reducing redundancy and potential memory wasting, as static members are not tied to any instantiated object .

In Java, the String class represents immutable character strings, while the StringBuffer class represents a mutable sequence of characters. This immutability in String means every modification of a string object results in a new object being created, which can be inefficient in scenarios of frequent modifications. In contrast, StringBuffer is designed for use when there are a lot of mutable strings' operations, as it can change its content without creating new objects, leading to better performance with large modifications .

Java's platform independence is primarily achieved through the use of bytecode, which is an intermediate representation of the code that is executed by the Java Virtual Machine (JVM). When a Java program is compiled, it is transformed into a platform-independent bytecode file, which the JVM can execute on any device or operating system that has a compatible JVM implementation. This means the same Java application can run on different platforms without any required modifications, making Java a 'write once, run anywhere' language .

You might also like