Module 3-Core Java
Module 3-Core Java
• Task: Write a Java program that prints "Hello, World!" to the console.
• Instructions:
2. Simple Calculator
• Objective: Practice arithmetic operations and user input.
• Task: Develop a calculator that performs addition, subtraction, multiplication, and division.
• Instructions:
• Instructions:
• Instructions:
5. Multiplication Table
• Objective: Implement loops.
• Instructions:
o Multiply the input number by the loop counter and display the result.
• Task: Declare variables of different primitive types and display their values.
• Instructions:
• Instructions:
8. Operator Precedence
• Objective: Explore how Java evaluates expressions.
• Instructions:
9. Grade Calculator
• Objective: Use conditional statements to determine grades.
• Instructions:
▪ 90-100: A
▪ 80-89: B
▪ 70-79: C
▪ 60-69: D
▪ Below 60: F
• Task: Create a game where the user guesses a randomly generated number.
• Instructions:
• Instructions:
• Task: Create multiple methods with the same name but different parameters.
• Instructions:
▪ Two integers.
▪ Two doubles.
▪ Three integers.
• Instructions:
o Define a recursive method fibonacci(int n) that returns the nth Fibonacci number.
• Instructions:
• Instructions:
o Prompt the user for a string.
• Instructions:
• Instructions:
• Instructions:
• Instructions:
• Instructions:
• Instructions:
• Instructions:
o Open output.txt for reading.
• Instructions:
• Instructions:
• Instructions:
• Instructions:
• Instructions:
29. Records
• Objective: Use the record keyword for immutable data structures (Java 16+).
• Instructions:
• Instructions:
o Use a switch expression to check if the object is Integer, String, Double, etc.
• Instructions:
o Set up a database with a students table.
o Write code to load the JDBC driver, create a connection, execute a SELECT query, and
print results.
• Instructions:
• Instructions:
• Instructions:
• Instructions:
• Instructions:
• Task: Compile a Java class and inspect its bytecode using javap.
• Instructions:
• Instructions:
• Instructions:
o Use Class.forName(), getDeclaredMethods(), and invoke() to call a method without
directly referencing it in code.
• Instructions:
• Instructions: