0% found this document useful (0 votes)
4 views

Java worksheet

Uploaded by

ssss23232023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Java worksheet

Uploaded by

ssss23232023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

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`)

You might also like