Create a class called ruler. Ruler should have length and breadth Create three object of the ruler class?

1 Answer

  • 8 months ago

    Hi, Nicholas. In Java a solution might be:

    public class RulerTest {

        public static void main (String[] args) {

            Ruler a = new Ruler();

            Ruler b = new Ruler();

            Ruler c = new Ruler();



    class Ruler {

        private int length  = 0;

        private int breadth = 0;


    This doesn't produce any output, but I think fulfills the requirements of the question.

    You might choose to call your main class another name than RulerTest.

    • Commenter avatarLog in to reply to the answers
Still have questions? Get answers by asking now.