★★★★★
"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."
Ria Mukherjee
Parent
CBSE Class 12 · IT 802 · Unit 3 Java · 2026-27
These Class 12 IT 802 Java notes take Unit 3 in the order CBSE prints it, from language elements to strings. Each topic gets a short explanation, then programs that show it working, with the output of a real run and the two or three points worth remembering.
Live online · 20 programs run on Java 21 · NetBeans steps · one to one at your hours · first class free
Start here
The Java course for teens begins with a first program and carries on well past Unit 3. MySQL is the other language of 802, and the Class 11 and 12 course suits a student who studies computer science too.

Java / 13 to 18
Variables, control flow, arrays, strings and object oriented programming first; later collections, desktop apps, games and data structures.
Open the course →
Unit 1 / MySQL
The database unit carries 15 theory marks. This course goes from a first SELECT to joins, grouping and design.
Open the course →
CS / Java and Python
Computer science for the board years in Python or Java, with practical work and viva preparation.
Open the course →Ans. The short version
Class 12 IT 802 Java notes cover Unit 3, which carries 20 of the 60 theory marks in 2026-27, plus 10 marks for a Java program in the practical. The unit lists language elements, operators, control flow, arrays, class design, exception handling, assertions, threads, wrapper classes and string manipulation. This page explains each topic and shows it in 20 original programs, every one compiled and run on Java 21. Modern Age Coders teaches the same topics in live one to one classes at your own timing, and you can try a full class through a priority demo first.
Q1. What is in the Java unit?
Unit 3 is the largest unit of the theory paper: 20 marks, with 30 hours of theory and 50 hours of lab work set aside for it. The syllabus names the topics below and does not divide the 20 marks among them.
| Topic in the syllabus | In one line | Programs here |
|---|---|---|
| Introduction to Java, language elements | Structure of a program, types, variables, constants | 1, 2 |
| Operators | Arithmetic, relational, logical, assignment, conditional | 3 |
| Control flow | if, switch, for, while, do-while, break, continue | 4 to 8 |
| Array | Many values of one type under one name | 9 to 11 |
| Class design, object oriented programming | Classes, objects, constructors, inheritance | 12 to 14 |
| Exception handling | Dealing with errors while the program runs | 15, 16 |
| Assertions | Testing that your own logic holds | 17 |
| Threads | Two tasks in progress at once | 18 |
| Wrapper classes | Objects that hold primitive values | 19 |
| String manipulation | Methods of the String class | 20 |
Create a Java Application project, then add one Java class per program and give it the name that follows public class. NetBeans puts a package line at the top; leave it there. Press Shift and F6 to run the open file rather than the whole project. Two abbreviations save typing: psvm then Tab writes the main method, and sout then Tab writes a println.
How Java runs: the compiler javac turns .java source into .class bytecode, and the Java Virtual Machine executes the bytecode. The JRE is the JVM with its libraries; the JDK adds the compiler and other tools. Because only the JVM is written for each operating system, the same bytecode runs on all of them.
Q2. What are the basics?
A variable is a named place in memory with a fixed type. Java has eight primitive types, and everything else, including String and arrays, is a reference type.
| Type | Size | Holds |
|---|---|---|
| byte | 8 bits | -128 to 127 |
| short | 16 bits | -32768 to 32767 |
| int | 32 bits | up to 2147483647 |
| long | 64 bits | bigger whole numbers, written 5L |
| float | 32 bits | decimals, written 2.5f |
| double | 64 bits | decimals, the usual choice |
| char | 16 bits | one Unicode character |
| boolean | not fixed | true or false |
| Operators, highest first | Kind |
|---|---|
++ -- ! | unary |
* / % | arithmetic |
+ - | arithmetic, joining text |
< <= > >= | relational |
== != | equality |
&& | logical and |
|| | logical or |
?: | conditional |
= += -= *= /= | assignment |
An identifier may use letters, digits, the underscore and the dollar sign, may not begin with a digit and may not be a keyword. Class names begin with a capital and variable names with a small letter by convention.
Show the difference between print and println, and between joining and adding.
public class FirstLook {
/* Everything inside main runs
from top to bottom. */
public static void main(String[] args) {
System.out.print("Unit");
System.out.print(" 3: ");
System.out.println("Java");
System.out.println("He said \"compile first\".");
System.out.println("Sum: " + 4 + 5);
System.out.println("Sum: " + (4 + 5));
System.out.println("Roll\tName\n7\tAfreen");
}
}
Unit 3: Java He said "compile first". Sum: 45 Sum: 9 Roll Name 7 Afreen
"Sum: " + 4 + 5 joins from left to right, so it prints 45. Brackets force the addition first.\t is a tab, \n a new line, \" a quotation mark inside text.Print the limits of some types and convert between types.
public class TypeTour {
public static void main(String[] args) {
System.out.println("byte " + Byte.MIN_VALUE
+ " to " + Byte.MAX_VALUE);
System.out.println("short " + Short.MIN_VALUE
+ " to " + Short.MAX_VALUE);
System.out.println("int max " + Integer.MAX_VALUE);
final int OVERS = 20; // a constant
long balls = OVERS * 6; // int to long, automatic
int whole = (int) 8.97; // double to int, cast
byte small = (byte) 130; // does not fit
char next = (char) ('P' + 1);
System.out.println("balls " + balls);
System.out.println("whole " + whole);
System.out.println("small " + small);
System.out.println("next " + next);
System.out.println("'P' as int " + (int) 'P');
}
}
byte -128 to 127 short -32768 to 32767 int max 2147483647 balls 120 whole 8 small -126 next Q 'P' as int 80
(byte) 130 wraps round to -126, because a byte stops at 127.final makes a constant: assigning to it again is a compile error.Predict each line before you read the output.
public class OperatorTour {
public static void main(String[] args) {
int a = 9, b = 4;
System.out.println(a / b + " " + a % b + " "
+ (double) a / b);
System.out.println(-a % b);
int c = a++; // use, then add
int d = ++b; // add, then use
System.out.println(a + " " + b + " " + c + " " + d);
a += 2.9; // cast hidden inside
System.out.println(a);
int zero = 0;
boolean safe = zero != 0 && 10 / zero > 1;
System.out.println(safe);
String size = a > 10 ? "big" : "small";
System.out.println(size);
System.out.println(6 + 3 * 2 - 8 / 4);
}
}
2 1 2.25 -1 10 5 9 5 12 false big 10
-9 % 4 is -1.&& stops at the first false, so the division by zero never happens.a += 2.9 hides a cast: 10 + 2.9 becomes 12.Q3. How do I control and repeat?
Selection statements choose, loops repeat, and an array gives a loop something to walk through. A for loop fits a known count, while fits an unknown one, and do-while fits a body that must run once before the test.
Classify a triangle from three sides.
import java.util.Scanner;
public class TriangleType {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Three sides: ");
int p = sc.nextInt();
int q = sc.nextInt();
int r = sc.nextInt();
if (p + q <= r || q + r <= p || p + r <= q) {
System.out.println("Not a triangle");
} else if (p == q && q == r) {
System.out.println("Equilateral");
} else if (p == q || q == r || p == r) {
System.out.println("Isosceles");
} else {
System.out.println("Scalene");
}
}
}
Three sides: 7 7 10 Isosceles Three sides: 3 4 9 Not a triangle
Print the number of days in a month of an ordinary year.
import java.util.Scanner;
public class MonthDays {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Month (1-12): ");
int month = sc.nextInt();
int days;
switch (month) {
case 4:
case 6:
case 9:
case 11:
days = 30;
break;
case 2:
days = 28; // 29 in a leap year
break;
default:
days = 31;
}
if (month < 1 || month > 12) {
System.out.println("Invalid month");
} else {
System.out.println(days + " days");
}
}
}
Month (1-12): 9 30 days Month (1-12): 13 Invalid month
break fall through on purpose, so 4, 6, 9 and 11 share one line.default also catches 13, which is why the range is tested before printing.Print a triangle of multiples.
public class TimesTriangle {
public static void main(String[] args) {
int rows = 5;
for (int r = 1; r <= rows; r++) {
for (int c = 1; c <= r; c++) {
System.out.print(r * c + " ");
}
System.out.println();
}
}
}
1 2 4 3 6 9 4 8 12 16 5 10 15 20 25
r times, so 1 + 2 + 3 + 4 + 5 = 15 numbers are printed.print stays on the line; the empty println ends the row.Find the HCF of two numbers by repeated remainders.
public class CommonDivisor {
public static void main(String[] args) {
int big = 1071, small = 462;
while (small != 0) {
int left = big % small;
System.out.println(big + " % " + small
+ " = " + left);
big = small;
small = left;
}
System.out.println("HCF is " + big);
}
}
1071 % 462 = 147 462 % 147 = 21 147 % 21 = 0 HCF is 21
Accept a limit of at least 2 and list the primes up to it.
import java.util.Scanner;
public class PrimeList {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int limit;
do {
System.out.print("Limit (2 or more): ");
limit = sc.nextInt();
} while (limit < 2);
int found = 0;
for (int n = 2; n <= limit; n++) {
boolean prime = true;
for (int d = 2; d * d <= n; d++) {
if (n % d == 0) {
prime = false;
break; // leaves the inner loop
}
}
if (!prime) {
continue; // next n
}
System.out.print(n + " ");
found++;
}
System.out.println("\n" + found + " primes");
}
}
Limit (2 or more): 1 Limit (2 or more): 30 2 3 5 7 11 13 17 19 23 29 10 primes
d * d <= n is enough, since a factor above the square root has a partner below it.break ends the inner loop; continue moves on to the next n.An array is created with new int[5] or with a list in braces, and its size cannot change afterwards. Indexes run from 0 to length - 1; anything else throws ArrayIndexOutOfBoundsException. New elements start as 0, 0.0, false or null according to type. length has no brackets for an array but is a method, length(), for a String.
Find the two largest different values without sorting.
public class SecondLargest {
public static void main(String[] args) {
int[] runs = {38, 71, 12, 71, 64, 5};
int first = Integer.MIN_VALUE;
int second = Integer.MIN_VALUE;
for (int r : runs) {
if (r > first) {
second = first;
first = r;
} else if (r > second && r != first) {
second = r;
}
}
System.out.println("Largest " + first);
System.out.println("Second " + second);
}
}
Largest 71 Second 64
r != first keeps the repeated 71 out of second place.Sort an array in ascending order and show every pass.
public class SortLevels {
static void show(int[] data) {
for (int value : data) {
System.out.print(value + " ");
}
System.out.println();
}
public static void main(String[] args) {
int[] level = {44, 18, 30, 9, 25};
for (int pass = 1; pass < level.length; pass++) {
for (int i = 0; i < level.length - pass; i++) {
if (level[i] > level[i + 1]) {
int temp = level[i];
level[i] = level[i + 1];
level[i + 1] = temp;
}
}
System.out.print("Pass " + pass + ": ");
show(level);
}
}
}
Pass 1: 18 30 9 25 44 Pass 2: 18 9 25 30 44 Pass 3: 9 18 25 30 44 Pass 4: 9 18 25 30 44
show() receives a reference to the same array, not a copy of it.Turn rows into columns.
public class Transpose {
public static void main(String[] args) {
int[][] seats = {{11, 12, 13, 14}, {21, 22, 23, 24}};
int rows = seats.length;
int cols = seats[0].length;
int[][] turned = new int[cols][rows];
for (int r = 0; r < rows; r++) {
for (int c = 0; c < cols; c++) {
turned[c][r] = seats[r][c];
}
}
for (int[] row : turned) {
for (int value : row) {
System.out.print(value + " ");
}
System.out.println();
}
}
}
11 21 12 22 13 23 14 24
seats.length counts rows; seats[0].length counts columns.If tracing loops is the slow part, the Class 10 board has good short exercises on the same Java: try our Java output questions.
Q4. What is class design?
A class describes what an object knows and can do; an object is one such thing in memory. Designing a class means choosing its data, its constructors, its methods and how much of it others may touch.
Data and the methods that use it are kept together, with the data private. Outsiders call a method, and the method can refuse.
A child class extends a parent and starts with its members. Java allows one parent class, and super reaches it.
One name, several forms: overloading is settled while compiling, overriding while the program runs.
| Access | Same class | Same package | Child in another package | Anywhere |
|---|---|---|---|---|
| private | yes | no | no | no |
| (none written) | yes | yes | no | no |
| protected | yes | yes | yes | no |
| public | yes | yes | yes | yes |
Create objects in three ways and call an overloaded method.
class Book {
String title;
int copies;
Book() {
this("Untitled", 0); // calls the other one
}
Book(String title) {
this(title, 1);
}
Book(String title, int copies) {
this.title = title;
this.copies = copies;
}
void issue() {
copies--;
}
void issue(int n) { // overloaded method
copies -= n;
}
}
public class BookDemo {
public static void main(String[] args) {
Book x = new Book();
Book y = new Book("Monsoon Maths");
Book z = new Book("River Atlas", 12);
y.issue();
z.issue(5);
System.out.println(x.title + " " + x.copies);
System.out.println(y.title + " " + y.copies);
System.out.println(z.title + " " + z.copies);
}
}
Untitled 0 Monsoon Maths 0 River Atlas 7
this(...) calls another constructor and must be the first statement.issue() or issue(int) from the arguments.Keep the balance private and allow changes only through methods.
class MetroCard {
private double balance;
public double getBalance() {
return balance;
}
public void recharge(double amount) {
if (amount >= 100) {
balance += amount;
} else {
System.out.println("Minimum recharge is 100");
}
}
public boolean travel(double fare) {
if (fare > balance) {
return false;
}
balance -= fare;
return true;
}
}
public class MetroCardDemo {
public static void main(String[] args) {
MetroCard card = new MetroCard();
card.recharge(60);
card.recharge(150);
System.out.println("Trip 1: " + card.travel(42.5));
System.out.println("Trip 2: " + card.travel(120));
System.out.println("Left: " + card.getBalance());
}
}
Minimum recharge is 100 Trip 1: true Trip 2: false Left: 107.5
card.balance = 9000: the compiler reports private access.Call the same method on objects of two child classes.
abstract class Staff {
protected String name;
Staff(String name) {
this.name = name;
}
abstract double pay();
void slip() {
System.out.println(name + ": " + pay());
}
}
class Librarian extends Staff {
Librarian(String name) {
super(name);
}
double pay() {
return 31000;
}
}
class Coach extends Staff {
private int sessions;
Coach(String name, int sessions) {
super(name);
this.sessions = sessions;
}
double pay() {
return sessions * 850.0;
}
}
public class StaffDemo {
public static void main(String[] args) {
Staff[] team = {new Librarian("Zoya"),
new Coach("Arnav", 24)};
for (Staff member : team) {
member.slip();
}
}
}
Zoya: 31000.0 Arnav: 20400.0
Staff cannot be instantiated; it only promises that each child has pay().protected lets child classes use name.pay().Constructors deserve a second reading, since default, parameterised and copy constructors are easy to mix up: see Java constructors explained.
Q5. How are errors and threads handled?
An exception is an object Java creates when something goes wrong at run time. Put the risky line in try, the remedy in catch, and work that must always happen in finally.
| Exception | A line that causes it |
|---|---|
| ArithmeticException | 10 / 0 with integers |
| ArrayIndexOutOfBoundsException | index 5 in an array of 5 |
| StringIndexOutOfBoundsException | "abc".charAt(5) |
| NumberFormatException | Integer.parseInt("ab") |
| NullPointerException | a method called on a variable that is null |
| ClassCastException | casting a String object to Integer |
All six are unchecked: the compiler does not force you to catch them. Checked exceptions, such as InterruptedException from sleep(), must be caught or declared. An error that stops compilation is not an exception at all.
Handle a missing index, text that is not a number, and zero.
public class ReadMarks {
static void read(String[] data, int index) {
try {
int value = Integer.parseInt(data[index]);
System.out.println("Share: " + 100 / value);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("No entry at " + index);
} catch (NumberFormatException e) {
System.out.println("Not a number: " + data[index]);
} catch (ArithmeticException e) {
System.out.println("Zero is not allowed");
} finally {
System.out.println("-- checked " + index);
}
}
public static void main(String[] args) {
String[] data = {"8", "ab", "0"};
for (int i = 0; i <= 3; i++) {
read(data, i);
}
}
}
Share: 12 -- checked 0 Not a number: ab -- checked 1 Zero is not allowed -- checked 2 No entry at 3 -- checked 3
finally runs each time.Raise an exception for a rule of your own.
public class RideCheck {
static int ticket(int heightCm) throws Exception {
if (heightCm < 120) {
throw new Exception("Too short by "
+ (120 - heightCm) + " cm");
}
return heightCm >= 150 ? 80 : 50;
}
public static void main(String[] args) {
int[] queue = {155, 112, 131};
for (int h : queue) {
try {
System.out.println(h + " cm pays " + ticket(h));
} catch (Exception e) {
System.out.println(h + " cm: " + e.getMessage());
}
}
}
}
155 cm pays 80 112 cm: Too short by 8 cm 131 cm pays 50
throw raises one exception; throws in the heading warns the caller.Exception is checked, so Java insists that the call is inside try or declared.Test a fact that must be true, first with assertions off and then on.
public class SplitCheck {
public static void main(String[] args) {
int sweets = 50, children = 8;
int each = sweets / children;
int left = sweets - each * children;
assert left >= 0 && left < children : "left is " + left;
System.out.println(each + " each, " + left + " left");
left = left + children; // wrong on purpose
assert left < children : "left is " + left;
System.out.println("Never checked: " + left);
}
}
6 each, 2 left Never checked: 10 6 each, 2 left Exception in thread "main" java.lang.AssertionError: left is 10 at SplitCheck.main(SplitCheck.java:10)
assert condition : message; does nothing until Java is started with -ea.start() begins a thread, run() holds its work, sleep(ms) pauses the current thread, join() waits for another to end, and getName() and setPriority() do what they say. There are two ways to make one: extend Thread, or implement Runnable and hand the object to a Thread. The second leaves your class free to extend something else.
Run two tasks together and wait for both.
class Ticker implements Runnable {
private int gap;
Ticker(int gap) {
this.gap = gap;
}
public void run() {
String me = Thread.currentThread().getName();
for (int i = 1; i <= 3; i++) {
System.out.println(me + " " + i);
try {
Thread.sleep(gap);
} catch (InterruptedException e) {
System.out.println(me + " stopped");
}
}
}
}
public class TwoClocks {
public static void main(String[] args) throws Exception {
Thread slow = new Thread(new Ticker(900), "slow");
Thread fast = new Thread(new Ticker(250), "fast");
System.out.println("Before start: " + slow.getState());
slow.start();
Thread.sleep(100); // let slow print first
fast.start();
slow.join();
fast.join();
System.out.println("After join: " + slow.getState());
}
}
Before start: NEW slow 1 fast 1 fast 2 fast 3 slow 2 slow 3 After join: TERMINATED
run(); start() creates the thread that executes it.Q6. Which methods should I know?
Every primitive type has a wrapper class: Byte, Short, Integer, Long, Float, Double, Character and Boolean. A String is an immutable sequence of characters with a long list of methods.
Box, unbox, parse and test characters.
public class WrapperTour {
public static void main(String[] args) {
Integer boxed = 45; // autoboxing
int plain = boxed + 5; // unboxing
System.out.println(plain);
int seats = Integer.parseInt("120");
double fare = Double.parseDouble("18.75");
System.out.println(seats * fare);
System.out.println(Integer.valueOf(7).equals(7));
System.out.println(Integer.toBinaryString(26));
System.out.println(Integer.compare(3, 9));
System.out.println(boxed.doubleValue());
System.out.println(Boolean.parseBoolean("TRUE"));
String code = "Gate 4B";
int letters = 0, digits = 0;
for (int i = 0; i < code.length(); i++) {
char ch = code.charAt(i);
if (Character.isLetter(ch)) letters++;
if (Character.isDigit(ch)) digits++;
}
System.out.println(letters + " letters, "
+ digits + " digit");
}
}
50 2250.0 true 11010 -1 45.0 true 5 letters, 1 digit
parseInt gives a primitive, valueOf gives an object.equals(), not with ==.Here s is "Information". Cover the right column and fill it yourself.
| Call | Result |
|---|---|
s.length() | 11 |
s.charAt(2) | f |
s.indexOf('o') | 3 |
s.lastIndexOf('o') | 9 |
s.substring(5) | mation |
s.substring(2, 6) | form |
s.toUpperCase() | INFORMATION |
s.replace('n', 'N') | INformatioN |
| Call | Result |
|---|---|
s.equals("information") | false |
s.equalsIgnoreCase("INFORMATION") | true |
"cat".compareTo("cow") | -14, that is 'a' minus 'o' |
s.contains("form") | true |
s.startsWith("In") | true |
s.endsWith("on") | true |
s.concat(" Tech") | Information Tech |
s.indexOf("zz") | -1 |
Shorten a full name to initials and surname.
import java.util.Scanner;
public class ShortName {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Full name: ");
String full = sc.nextLine().trim().toLowerCase();
String[] words = full.split(" +"); // 1 or more spaces
String result = "";
for (int i = 0; i < words.length; i++) {
char first = words[i].charAt(0);
first = Character.toUpperCase(first);
if (i < words.length - 1) {
result = result + first + ". ";
} else {
result = result + first
+ words[i].substring(1);
}
}
System.out.println(result);
System.out.println(result.length() + " characters");
}
}
Full name: kamala devi RATHORE K. D. Rathore 13 characters
split(" +") treats several spaces as one gap.substring(1) is everything after the first character.Longer practice sets: string handling in Java and string and array programs.
Q7. Why will my program not compile?
Read the first message and ignore the rest until it is fixed, because one missing character can produce a page of red. These are the exact messages Java 21 gave for ten deliberate mistakes.
| Message | What we wrote | Cure |
|---|---|---|
';' expected | int a=5 | Add the semicolon |
package system does not exist | system.out.println | Capital S in System |
incompatible types: possible lossy conversion from double to int | int a=7.5; | Use double, or cast |
missing return statement | return only inside an if | Return on every path |
variable t might not have been initialized | int t; t++; | Give t a starting value |
class Wrong is public, should be declared in a file named Wrong.java | file saved as E6.java | Match class and file name |
unreported exception Exception; must be caught or declared to be thrown | throw new Exception("x"); | try and catch, or throws |
cannot assign a value to final variable A | final int A=2; A=3; | Remove final or the second line |
Z is abstract; cannot be instantiated | new Z() | Create a child class object |
b has private access in E10 | private field used outside | Use a public method |
Type them, then change one line in each and say the new output before running.
Write programs 9 to 11 again with your own data and no help.
Design a class for something you own, with two constructors and one method that can refuse.
Make every exception in the table happen once on purpose.
Fill the string table from memory, then write one program of 15 lines under a timer.
When the topics feel steady, put them in the file: the 802 practical file and NetBeans project. Definitions from the other units are in the IT 802 notes, the full marks table in the IT 802 syllabus, and exam practice in the IT 802 sample paper.
One to one, at your own timing
Reading Java is easier than writing it, and a single class will show the gap. Book a priority demo, a paid full class at a slot of your choice: a written skill report follows, and what you paid is taken off the first month if you join. There is also a free demo class. Lessons after that are private, on days you pick.
Before you enrol · Try a class
a full live class of about 45 to 60 minutes
The classes · Choose your own timing
₹4,999
per month, 4 private classes, fully flexible timingtwo private classes a week, at a time set with you
Students who met Java in Class 11 usually need classes and exceptions most. Those new to it begin with program 1 and need longer. Say which you are, and the fee shown above is what one month costs.
Studying outside India?
A private class needs only an hour that is free at both ends. The table shows the time difference and when students in each place are normally home.
| Where you live | Time difference | Usual class window, local time | Format |
|---|---|---|---|
| India every Indian city | Indian time | Any time you choose | Personalised 1-on-1 |
| UAE and Oman Dubai, Abu Dhabi, Sharjah, Muscat | 1 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Saudi Arabia, Qatar, Kuwait, Bahrain Riyadh, Jeddah, Dammam, Doha, Kuwait City, Manama | 2 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Nepal Kathmandu | 15 min ahead of India | 4:30 PM to 9:00 PM | Personalised 1-on-1 |
| Ethiopia and East Africa Addis Ababa and East Africa Time | 2 h 30 min behind India | 4:30 PM to 9:00 PM | Personalised 1-on-1 |
| Singapore and Malaysia Singapore, Kuala Lumpur | 2 h 30 min ahead of India | 3:30 PM to 9:00 PM | Personalised 1-on-1 |
NetBeans and the JDK are free to install, so a student anywhere can share the same screen as the teacher. If 802 is still a choice for you and not yet a subject, read how CS, IP, AI and IT compare.
What families say
Real reviews from real families. We neither write nor commission them.
★★★★★
"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."
Ria Mukherjee
Parent
★★★★★
"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."
Samriddha Mondal
Student
★★★★★
"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."
Vansh Agarwal
Student
★★★★★
"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."
Sonam Oswal
Parent of Dhairya
★★★★★
"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."
Sonu Goyal
Parent
★★★★★
"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."
Ritu Kedia
Parent
The rest of the Class 12 series
Every page in the CBSE Class 12 Information Technology series, grouped by what you need.
CBSE Class 12 Computer Science (083): Class 12 CS viva questions Class 12 CS sample paper practice Class 12 CS project with source code Class 12 CS important questions
CBSE Class 12 Informatics Practices (065): Class 12 IP practical file Class 12 IP project with source code Class 12 IP sample paper practice Class 12 IP important questions
CBSE Class 11 CS, IP and AI: Class 11 CS practical file Class 11 IP practical file CS or IP in Class 11
ISC Computer Science (868): ISC Class 12 CS syllabus 2027 ISC Class 12 CS practice paper ISC Class 12 practical questions solved ISC Boolean algebra and K-maps
Program lists with output: String and array programs in Java Java project ideas
Java questions
Unit 3, Java, carries 20 of the 60 theory marks in 2026-27. In the practical a Java program carries 10 marks, the practical file of 10 marks must include at least 15 Java programs, and the 5-mark project is an application made in NetBeans. Java is the biggest single part of the subject.
Fundamentals of Java programming, introduction to Java, object oriented programming, Java language elements, operators, control flow, array, class design, exception handling, assertions, threads, wrapper classes and string manipulation. That is the list in the 2026-27 curriculum, and this page has at least one program for each.
Use Print in your browser on this page and choose Save as PDF. You get the notes, tables and all 20 programs. Better still, type the programs as you read; a page you have typed stays in memory longer than one you have saved.
The school and examiner choose, so there is no published list. Since the lab asks for one Java program worth 10 marks, practise a loop program, an array program, a class with a constructor, a program with try and catch, and a string program. Write those five unaided and you have used the main statements of the unit.
The ideas carry over; the writing changes. Java needs a class around everything, a type for each variable, semicolons and braces. Expect a week of compile errors, then it settles. Classes, threads and assertions are usually the new topics.
A constructor has the same name as its class, has no return type and runs once when an object is created with new. A method can have any name, must state a return type or void, and runs whenever it is called. If you write no constructor, Java supplies one without parameters.
Wrapper classes are classes that hold a primitive value as an object: Integer for int, Double for double, Character for char, and so on for all eight types. They also carry useful methods, such as Integer.parseInt to convert text into a number and Character.isDigit to test a character.
An assertion is a statement that a condition must be true, written with the keyword assert. If it is false, Java throws AssertionError. Assertions are off by default. Start Java with the option -ea, or in NetBeans add -ea under Run in the project properties, in the VM options box.
throw is used inside a method to raise one exception object at that moment. throws is written in the method heading to declare which exceptions may come out of it, so that the caller handles them. One is an action; the other is a warning.
For content, yes. The == operator asks whether two variables refer to the same object, and equals() asks whether the characters are the same. Two literals may share one object and make == look correct, which is why the mistake hides until a value comes from the keyboard.
They are not named in the Class 12 unit list for 2026-27. NetBeans forms are needed for the project, and those use Swing controls such as jButton and jTextField, which appear in the Class 11 syllabus. Learn extra topics for interest once Unit 3 is secure.
Yes. Our classes are live and private, on the days and at the hour you choose, and the student writes the code on a shared screen. Try a priority demo or the free demo class before deciding. Billing is monthly and you may stop at any month end.
Start
Choose a topic that makes you nervous, whether it is arrays, constructors or threads. In the demo class you write a short program on it, we talk about each error as it appears, and at the end you know how much of Unit 3 is ready.
For a slot you pick yourself there is the priority demo: a paid full class, a written skill report after it, and the fee adjusted against the first month for those who enrol.
WhatsApp us · +91 91233 66161 · connect@modernagecoders.com
Every class is live video. The form requests a callback and reserves nothing.
A full live class of about 45 to 60 minutes at a slot you pick, with a written skill report and learning roadmap on WhatsApp afterwards. The fee is adjusted against your first month if you enrol.
Book a priority demo