CLASS: XII INFORMATION TECHNOLOGY (802)
DATE: JAVA PROGRAMMING
1. Find errors in Java code snippets and correct them:
java
public class ErrorExample {
public static void main(String[] args) {
int num1 = "10";
int num2 = 20;
int sum = num1 + num2;
System.out.println("Sum: " + sum);
}
}
2. Write a Menu-driven program to perform string operations using Switch.
Write a Java program that displays a menu with options for converting a string to
uppercase, lowercase, finding its length, and reversing it. Depending on the user's choice (1
for uppercase, 2 for lowercase, etc.), perform the corresponding operation on a string entered
by the user.
3. Write a Program to Calculate the Product of Two Numbers using a user-defined method.
(Method name: `productOf2Numbers`)