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, 24.06.2019 08:00
Arah has entered data about football players from team a and team b in a worksheet. she enters names of players from team a with details about each player in different columns of the worksheet. similarly, she enters details of all the players from team b. which option will her view the data for team a and team b in two separate sections after printing? a. page break view b. freeze pane view c. split screen view d. full screen view e. zoom out view
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Which two technologies support the building of single-page applications?
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. the program should output the average high, average low, and the highest and lowest temper- atures for the year. your program must consist of the following functions: a. function getdata: this function reads and stores data in the two- dimensional array. b. function averagehigh: this function calculates and returns the average high temperature for the year. c. function averagelow: this function calculates and returns the aver- age low temperature for the year. d. function indexhightemp: this function returns the index of the highest high temperature in the array. e. function indexlowtemp: this function retur
Answers: 3
question
Computers and Technology, 24.06.2019 16:30
Which program can damage your computer?
Answers: 1
You know the right answer?
Consider the following definition of the class MyClass public class My Class {
private int x,...
Questions
question
Mathematics, 28.11.2019 03:31
Questions on the website: 13722363