Category Archives: Java Programs using Classes and Objects

Create New Java Class Calculation Add Subtract

Java Program – Create a new class Calculation with add() and subtract methods to add two numbers and to subtract two numbers. Write down a Java Program to Design a Calculation Class with the following features: Define two instance variables num1, num2 of type double. Define two constructors – default constructor to initialize num1 and… Read More »

 3,299 total views,  2 views today

Creating New Box class in Java

Task: Write a Java program to create a new Box class in Java. Use three instance variables width, height and depth of type double. Write down two constructors. Default ( no-arg )constructor will intialize the Box class objects with 0.0 value for all instance variables. A parameterized constructor will be used to intialize the object… Read More »

 9,379 total views,  4 views today

Define Bar Chart Class in Java Program

Task: Define Bar Chart Class in Java Program Define Bar Chart Class in Java Program-Specification Define Sales Bar Chart Class in Java Program Write a Java program to accomplish the following tasks 1. Define a class BarChart in Java. 2. Add an array of double in it as a field 3. Define two constructors: no… Read More »

 1,863 total views,  1 views today

Define Circle Class in Java with Radius and Area

Task: Define Circle Class in Java with Radius and Area How To Define Circle Class in Java First of all, let’s consider the specification of a Circle class: Write a Java Program to create a  class Circle with the following features: Fields of Circle Class 1. A field radius of type double 2. a constant… Read More »

 18,738 total views,  9 views today

Create a New Java Class Rectangle – Java Program

Create a new Java Class Rectangle – This Python Tutorial will explain the creation of a new Java class named Rectangle with the following class specification: How To Create a New Rectangle Class in Java Write a Java program using Objects and Classes concepts in Object Oriented Programming. Define the Rectangle class that will have: Two… Read More »

 31,708 total views,  8 views today