You are on page 1of 1

Object Oriented Programming 1

Engineering track / 2nd year


2023-2024

Lab # 2 : Classes et Objects (1)

Statement

You create a first small program in Java, which will have a FeuDeSignalisation class. In the main module,
it will create two objects of this class, using two overloaded constructors. It will change their color, an
object attribute, and then query those objects for the value of their static height attribute (a class
attribute), which it will modify in several ways.

It will end up executing the flash method on one of these objects, in its three overloaded versions,
passing as an argument the durations of the off and on phases.

For now, ignore the presence of the Public and Private keywords, which must be specified. The code
results in the same result on screen.

In Java you will write Java code in a single file, although it contains two classes and a much better
practice is to separate the classes into as many files. You do it here for reasons of ease and simplicity
given the smallness of the codes presented.

You might also like