0% found this document useful (0 votes)
2 views1 page

Java

The document outlines a series of programming tasks for creating classes and methods in a programming language. It includes instructions for creating a Calculator, Greeting, Circle, Student, and EvenOdd class, each with specific methods and functionalities. Each task emphasizes the creation of objects and method calls, providing hints for implementation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Java

The document outlines a series of programming tasks for creating classes and methods in a programming language. It includes instructions for creating a Calculator, Greeting, Circle, Student, and EvenOdd class, each with specific methods and functionalities. Each task emphasizes the creation of objects and method calls, providing hints for implementation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SECTION A — METHODS & OBJECT CREATION

1.
Create a class Calculator with a method add(int a, int b) that returns the sum. Create
an object and call the method.
Hint: Use return type int
Easy
2.
Create a class Greeting with a method sayHello(String name) that prints "Hello, <name>!".
Create an object and call it.
Hint: void method with String parameter
Easy
3.
Create a class Circle with a method area(double radius) that returns the area. Create an
object and print the result.
Hint: Area = π × r²
Easy
4.
Create a class Student with a method displayInfo(String name, int age) that prints the
student's details. Create 3 different objects and call the method.
Hint: Create 3 objects using new keyword
Easy
5.
Create a class EvenOdd with a method check(int number) that returns "Even" or "Odd". Call it
with 5 different numbers.
Hint: Use % operator, return type String
Easy

You might also like