ICSE Class 10 Java – Notes (13 Topics)
1. OOP Concepts
- Class: Blueprint (e.g., Student, Car).
- Object: Instance of a class.
- Encapsulation: Data hiding using private variables and public methods.
- Inheritance: Child class acquiring parent properties.
- Polymorphism: Same name, different forms (overloading, overriding).
- Abstraction: Hiding details, showing essential features.
Example:
class Student {
int roll;
String name;
void setData(int r, String n) {
roll = r; name = n;
}
void showData() {
System.out.println("Roll: " + roll + ", Name: " + name);
}
}
class Test {
public static void main() {
Student s = new Student();
s.setData(10, "Arnav");
s.showData();
}
}
2. Value and Datatypes
- Primitive: int, double, char, boolean, byte, short, long, float.
- Non-primitive: String, Arrays, Objects.
3. Operators in Java
- Arithmetic: + - * / %
- Relational: < > <= >= == !=
- Logical: && || !
- Assignment: = += -= *= /= %=
- Increment/Decrement: ++ --
- Ternary: ? :
⚠ Weak Point: Logical operator OR (`||`) → true if at least one is true. Example: true || false
= true
4. Scanner Class
Used to take input from user:
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
double d = sc.nextDouble();
String s = sc.next();
5. Math Library Methods
- sqrt(x), pow(a,b), abs(x), max(a,b), min(a,b)
- ceil(x), floor(x), round(x)
- random() → decimal between 0 and 1
⚠ Weak Point: Not all return double. e.g. Math.round(5.6) returns long/int. abs() depends
on argument type.
6. Condition in Java
Types: if, if-else, if-else-if, nested if, switch-case, ternary ? :
7. Iterative Construct (Loops)
while, do-while, for, break, continue.
8. Nested Loops
Loops inside loops – used for patterns, tables, grids.
9. Methods
Types:
1. No args, no return
2. Args, no return
3. No args, return
4. Args, return
Static methods can be called without objects.
Method overloading → same name, diff. parameters.
10. Constructors
- Same name as class, no return type.
- Types:
• Default constructor (no args)
• Parameterized constructor (args passed)
• Overloaded constructor (multiple constructors with diff. parameters)
⚠ Weak Point: If you define a parameterized constructor but no default one, Java does NOT
provide default.
11. Library Classes
- Math: sqrt(), pow(), random()
- Integer: parseInt(), toString()
- Character: isDigit(), isLetter(), toUpperCase()
- Double: parseDouble()
12. Strings
- Methods: length(), charAt(), toUpperCase(), toLowerCase(),
substring(), indexOf(), lastIndexOf(), equals(), compareTo(), trim()
- Common Programs: reverse, palindrome, count vowels
⚠ Weak Point: Why s.length()-1 → last index = length - 1. (Index starts at 0)
⚠ Weak Point: CountVowels uses "aeiou".indexOf(ch) != -1 to check vowels instead of 5 if
checks.
13. Arrays
- 1D array: int[] arr = new int[5];
- 2D array: int[][] mat = new int[3][3];
- Traverse using for/for-each.
- Programs: sum, max, min, search, sort, matrix addition, transpose.
✅ Summary
All 13 topics completed. Weak points highlighted for extra practice.