subject
Computers and Technology, 05.07.2021 19:30 bunnles

Code in Java: 1) Assume there is a class named Animal with an attribute named name of type String and a get method named getName. Assume there are two objects a1 and a2 of type Animal already declared and their names are already set. Write a java expression that checks if the names of the Animal objects a1 and a2 are equal.
2) Assume there is a class named Car with an attribute named model of type String and a get method named getModel. Assume there is an object c1 of type Car already declared and its model already set. Write a java statement that sets the variable ch of type char ( already declared) to the third character of the c1's model.
3) Assume there is a class Lamp having a private attribute named status of type boolean. Write a method named whatIsStatus for the Lamp class that accepts a Lamp object as its parameter and returns a text value based on the status of the passed object as follows:
if the status is true return "ON" , if the status is false return "OFF" , otherwise return "ERROR".

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
The "instance" relationship shows that something is an object of a
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Which finger presses the h key on the keyboard? index finger on the left hand pinky finger on the right hand index finger on the right hand thumb on the left hand
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Which tool could be used to display only rows containing presidents who served two terms
Answers: 3
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
You know the right answer?
Code in Java: 1) Assume there is a class named Animal with an attribute named name of type String a...
Questions
question
Mathematics, 05.02.2021 04:40
question
Mathematics, 05.02.2021 04:40
question
Mathematics, 05.02.2021 04:40
question
Mathematics, 05.02.2021 04:40
question
English, 05.02.2021 04:40
question
Mathematics, 05.02.2021 04:40