Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A.5 -5 Points To keep track of the number of objects created using a class, Writ

ID: 3720923 • Letter: A

Question

A.5 -5 Points To keep track of the number of objects created using a class, Write the void method: designGreeting do you use an instance variable or a static variable? B.2 - 5 Points - When "Cinco de Mayo" is passed to this method, it prints "Happy Cinco de Mayo!" - Write a statement to invoke it in the main method Circle INSTANCE or STATIC Write statement(s) to declare and initialize this variable A.6-5 Points A Java class uses variables to define A Java class uses methods to define // in the main method A Java class has a special type of methods whose names are identical to the name of that class. What are they called? B.3 - 5 Points Write the value-returning method: createGreeting -When "Cinco de Mayo" is passed to this method, it returns "Happy Cinco de Mayo!" - Write a statement to invoke it in the main method PART B-70 Points B.1 - 5 Points Write the void method: printGreeting This method when invoked prints: "Cinco de Mayo!" Write a statement to invoke it in the main method // in the main method // in the main method

Explanation / Answer

Question 1

Answer:

static variable

public static int objectCount = 0;

Question 2

Answer:

properties

Question 3

Answer:

Behaviours

Question 4

Answer:

Constructor

Greetings.java

public class Greetings {

public static void main(String[] args) {

printGreeting();

designGreting("Cinco de Mayo");

System.out.println(createGreeting("Cinco de Mayo"));

}

public static void printGreeting() {

System.out.println("Cinco de Mayo!");

}

public static void designGreting(String name) {

System.out.println("Happy "+name+"!");

}

public static String createGreeting(String name) {

return "Happy "+name+"!";

}

}

Output:

Cinco de Mayo!

Happy Cinco de Mayo!

Happy Cinco de Mayo!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote