ICSE Class 10 Full Computer Theory Notes
ICSE Class 10 Full Computer Theory Notes
---
**Definition:**
OOP is a programming paradigm based on the concept of "objects," which can contain data and
methods.
- Example: A "Car" class defines properties like color, model, and methods like start() or stop().
```java
class Car {
String color;
void start() {
System.out.println("Car started");
```
3. **Encapsulation**: Wrapping data and methods into a single unit and restricting direct access.
4. **Inheritance**: One class acquires the properties of another.
**Real-life Analogy:**
---
## 2. Introduction to Java
**Key Features:**
```java
class HelloWorld {
System.out.println("Hello, World!");
```
---
```java
```
**Type Casting:**
Example:
```java
int a = 10;
float b = a; // Widening
---
## 4. Operators in Java
**Types of Operators:**
1. **Arithmetic Operators**: +, -, *, /, %.
**Example:**
```java
```
---
## 5. Control Structures
```java
System.out.println("Pass");
} else {
System.out.println("Fail");
```
### Switch-Case
```java
switch (day) {
default: System.out.println("Invalid");
```
---
## 6. Loops
**For Loop:**
```java
System.out.println(i);
```
**While Loop:**
```java
int i = 1;
while (i <= 5) {
System.out.println(i);
i++;
```
**Do-While Loop:**
```java
int i = 1;
do {
System.out.println(i);
i++;
```
---
## 7. Arrays
**One-Dimensional Array:**
```java
System.out.println(numbers[i]);
```
**Key Operations:**
1. Traversal
---
## 8. String Handling
**Methods:**
Example:
```java
System.out.println(name.length()); // Output: 4
```
---
## 9. User-defined Methods
**Syntax:**
```java
returnType methodName(parameters) {
// Code
```
**Example:**
```java
return a + b;
```
---
**Basic Operations:**
1. Writing to a file.
Example:
```java
fw.write("Hello, World!");
fw.close();
```
---
## 11. Exception Handling
**Example:**
```java
try {
int result = 10 / 0;
} catch (ArithmeticException e) {
```
---
---