OOP Lab Task 1

De la WikiLabs
Jump to navigationJump to search

Required Tutorials

Requirements

  • Write a class called Message which should abstract out a physical letter. Class Message should have fields for sender, receiver and content, of type string of characters.
  • Write a method called print(), member of class Message, which will output in the standard stream (console), the information related to Message objects, in the format: From <sender> to <receiver>: <content> (use System.out.println());
  • Write a class called TestClass which should only contain the main method as a member, in which you should instantiate 3 objects of type Message, initialize their fields with different values and call, for each object, the method print().