subject

Consider the following definition of the class MyClass public class My Class {
private int x, private static int count, private MyClass ( ) {
} public MyClass (int a) {
} public void setX({ant a) {
} public void printx() {
} public static void printCount () {
} public static int incrementCount () } }

a. White a Java statement that increments the value of count by 1
b. Write a Java statement that outputs the value of count
c. Write the definition of the constructors and methods of the class MyClass as described above (3)
d. Write a Java statement that declares myObject1 to be a MyClass object and initialises its instance variable x to 5 (1)
e. Write a Java statement that declares myObject2 to be a MyClass object and initialises its instance variable x to 7 (1)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 12:00
From excel to powerpoint, you can copy and paste a. cell ranges and charts, one at a time. b. cell ranges and charts, simultaneously. c. charts only. d. cell ranges only.
Answers: 3
question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
question
Computers and Technology, 23.06.2019 19:30
Amitha writes up a one-page summary of a novel during her summer internship at a publishing company. when she reads over the page, she realizes she used the word “foreshadow” seven times, and she would like to reduce the repetition. which tool would best amitha solve this problem?
Answers: 3
You know the right answer?
Consider the following definition of the class MyClass public class My Class {
private int x,...
Questions
question
Mathematics, 01.04.2021 04:50
question
Mathematics, 01.04.2021 04:50
question
Mathematics, 01.04.2021 04:50
question
English, 01.04.2021 04:50
question
Mathematics, 01.04.2021 04:50
question
Mathematics, 01.04.2021 04:50
question
History, 01.04.2021 04:50
question
Mathematics, 01.04.2021 04:50
Questions on the website: 13722361