Question
When answering the following questions, consider this program; comments indicate where missing needed components of the program are to be placed. public class MyClass {
When answering the following questions, consider this program; comments indicate where missing needed components of the program are to be placed.
public class MyClass { // (1) definition of MyClass constructor public static void greetings() { // definition of greets } public void update(int num, String title) { // definition of update } } public class MainClass { //definition of a function that prints out a greeting public static void main(String[] args) { //(2) print the greeting //(3) construct a MyClass object called myObject //(4) update myObject } }
a) Write the header of MyClass constructor (line (1) above)
b) Write a statement to call the method that prints the greeting, at line(2) above. Note that myObject is an object of MyClass defined in the question above.
c) Create an object, called myObject, from data type MyClass at line (3) above.
d) Call the update method for myObject at line(4) above with arguments 3 and "Hi".
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started