Last Day Revision Notes
BCA — Bachelor of Computer Applications
8 12 25+ 100%
Core Topics Important Questions Code Examples Exam Ready
Contents
■
Java Basics — Features, Data Types, Control Flow
01
■
OOP Concepts — 4 Pillars, Classes, Constructors
02
■
Inheritance — Types, Overriding, Polymorphism
03
■
Abstract Classes & Interfaces
04
■
Exception Handling — try-catch, throw/throws
05
■
Strings & Arrays — Methods, StringBuilder
06
■
Multithreading — Lifecycle, Synchronization
07
■
Collections — List, Set, Map, Queue
08
■
Important Exam Questions (2 & 5 marks)
09
, 01 — Java Basics
Java Key Features
• Platform Independent — compiled to bytecode (.class), runs on any JVM
• Object-Oriented — everything is an object (except primitives)
• Strongly Typed — every variable must be declared with a type
• Automatic Memory Management — Garbage Collector frees unused objects
• Multithreaded — built-in support for concurrent execution
• Secure & Robust — no pointers, exception handling, type checking
Note: JDK = JRE + compiler tools. JRE = JVM + libraries. JVM actually runs the bytecode.
Primitive Data Types Access Modifiers & Key Keywords
• byte — 1 byte (−128 to 127) • public — accessible everywhere
• short — 2 bytes • private — only within same class
• int — 4 bytes (most used) • protected — same package + subclasses
• long — 8 bytes (suffix: L) • default (no keyword) — same package only
• float — 4 bytes (suffix: f) • ■■■■■■■■■■■■■■■■■■■■■
• double — 8 bytes (default decimal) • static — belongs to class, not instance
• char — 2 bytes (Unicode) • final — constant / no override / no inherit
• boolean — true / false • this — current object reference
• super — parent class reference
Basic Program Structure
public class Hello {
public static void main(String[] args) {
// entry point of every Java program
System.out.println("Hello, World!");
int x = 10; // integer variable
double pi = 3.14; // decimal variable
String name = "BCA"; // reference type
// Type casting
int a = (int) pi; // explicit: double -> int (data loss possible)
double b = x; // implicit: int -> double (widening, safe)
, }
}
Control Flow Quick Reference
// if-else
if (x > 0) { ... } else if (x == 0) { ... } else { ... }
// switch
switch (day) {
case 1: System.out.println("Monday"); break;
default: System.out.println("Other");
}
// for loop
for (int i = 0; i < 5; i++) { ... }
// while loop
while (i < 5) { ... }
// do-while loop
do { ... } while (i < 5);
// enhanced for (for-each)
for (String s : names) { ... }