Creating Class and methods – Java OOP Exercise

Java OOP exercise to learn how to create class and methods by reading requirements. Exercise-1: Create a class Dog, that has 3 properties (class fields) breed, age and colour with behaviours (class method) bark and sleep. Exercise-2: There is a car, which has attributes model and price, and the car has functionalities start, stop and … Read more Creating Class and methods – Java OOP Exercise

Check Your Java OOPs Concepts Skills and Master it Quickly

Did you finish learning Java OOPs Concepts? Check your level with tricky Coding & Conceptual OOP questions –  Master and Get Ready for writing industry-level application in no time with the book OOP Concepts Booster! (Try these 5 Coding and 15 Conceptual Questions!) Coding OOP Questions: Q-1) Below is a bank user account class. The … Read more Check Your Java OOPs Concepts Skills and Master it Quickly

Student details using an array of objects: Java Exercise

You’ll learn to implement a program for Student details using an array of objects in Java. EXERCISE: Create an array of objects of the Student class, of size 3. The Student class is defined below. Create three objects of the Student class, with values, and assign the objects to the array. Loop through the array … Read more Student details using an array of objects: Java Exercise

Shape Interface Implementation: Java Exercise

EXERCISE: Create a Shape interface having methods area () and perimeter (). Create 2 subclasses, Circle and Rectangle that implement the Shape interface. Create a class Sample with main method and demonstrate the area and perimeters of both the shape classes. You need to handle the values of length, breath, and radius in respective classes to … Read more Shape Interface Implementation: Java Exercise

Java Exercise – On Constructor with Solution

Java exercises on constructor with solutions. EXERCISE-1: Answer the following questions in brief. When a class constructor gets called? If you create 5 objects of a class, then how many time constructors will be called? When you write a constructor, what return type do you write in constructor declaration? Why do you use constructor? EXERCISE-2: … Read more Java Exercise – On Constructor with Solution