Question

Define an abstract class Name Java class that implements interface Comparable                              

Define an abstract class

Name Java class that implements interface Comparable   

                                             

Homework Answers

Answer #1

Abstract class

An abstract class in java is one which is usually used as a parent class.
We cannot instantiate an abstract class (We cannot create object of that class).
An abstract class may or may not have abstract method. An abstract method is one which is declared in abstract parent class and implemented in child classes (classes which extend abstract class).
We can extend abstract class by creating child classes & can access its attributes & behaviors using child classes.

Example:
Below is a java program which represents an abstract class and a child class.

Name Java class that implements interface Comparable   

// Name class which implements Comparable interface

public class Name implements Comparable{
  
@Override
public int compareTo(Object o) {
return 0;
}
}

----------------------------------------------------------------------
COMMENT DOWN FOR ANY QUERIES!!!
HIT A THUMBS UP IF YOU DO LIKE IT!!!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Pleas code in Java Write a generic class named PairImpl that implements the interface below.write a...
Pleas code in Java Write a generic class named PairImpl that implements the interface below.write a program that creates list of 3 pairs where each pair represents the name of a fruit and the quantity.    Once the list is populated three pairs of fruits and quantities, it then prints each pair shown in the sample run using a for loop.
Coding in Java Create an Airplane class (not abstract) that uses the Vehicle interface in Q1....
Coding in Java Create an Airplane class (not abstract) that uses the Vehicle interface in Q1. The code for all methods should print simple messages to the screen using System.out.println(). Add an integer speed variable that is changed using ChangeSpeed method. ChangeSpeed adds 5 to the speed each time it is called. Create a default constructor that sets the initial speed to 0. Don't create other constructors or any setter/getter methods. // code from Q1: interface Vehicle { void Start();...
Describe the characteristics of an abstract class in java
Describe the characteristics of an abstract class in java
Create an Airplane class (not abstract) that uses the Vehicle interface in Q1. The code for...
Create an Airplane class (not abstract) that uses the Vehicle interface in Q1. The code for all methods should print simple messages to the screen using System.out.println(). Add an integer speed variable that is changed using the ChangeSpeed method. ChangeSpeed adds 5 to the speed each time it is called. Create a default constructor that sets the initial speed to 0. Don't create other constructors or any setter/getter methods. PLEASE CODE THIS IN JAVA
Java API Usage: Use the Java API documentation for Standard Edition 7 to answer the following:...
Java API Usage: Use the Java API documentation for Standard Edition 7 to answer the following: a) List the full prototype for the methods that must be coded if a class implements the java.util interface named Iterator. b) How many methods are in the class Track? c) What package is the class Track located in? I am asking for the signature of the method, which is the first line which tells the return data type, the name of the method,...
What is the output of the following Java program? interface Food {     public void printFlavor();...
What is the output of the following Java program? interface Food {     public void printFlavor(); } class Pepper implements Food {     public void printFlavor() { System.out.println("spicy"); } } public class Lunch {     public static void main(String[] args) {        Food pepper = new Pepper();         pepper.printFlavor();     } } Select one: a. spicy b. no output c. the program does not compile d. bland e. bland spicy
Consider the following incomplete declaration of a Name class for 2a-2c. public class Name something missing...
Consider the following incomplete declaration of a Name class for 2a-2c. public class Name something missing {    private String first;    private String last;    public Name(String firstName, String lastName)    { first = firstName; last = lastName;    }    //additional methods } 2a) In the first two parts, you will modify the Name class so that it implements the Comparable interface. Show here what should go in place of something missing in the first line of the...
Which of the following situations described is a good situation to use an abstract class, and...
Which of the following situations described is a good situation to use an abstract class, and where it would be better to use than either a concrete class or an interface? When some methods in the class are abstract and some are concrete, and some variables in the class need to be private, while other variables need to be public When the inheriting class is closely related to the abstract class, such as with an "is-a" relationship When the objects...
6. Analyzable Interface Modify the CourseGrades class you created in Programming Challenge 5 so it implements...
6. Analyzable Interface Modify the CourseGrades class you created in Programming Challenge 5 so it implements the following interface: public interface Analyzable { double getAverage(); GradedActivity getHighest(); GradedActivity getLowest(); } The getAverage method should return the average of the numeric scores stored in the grades array. The getHighest method should return a reference to the element of the grades array that has the highest numeric score. The getLowest method should return a reference to the element of the grades array...
Just give answer no need to exmplain. ___________ implements the IList interface? Stack ArrayList Queue Hashtable...
Just give answer no need to exmplain. ___________ implements the IList interface? Stack ArrayList Queue Hashtable How can we decrease the Capacity of Collection Calling TrimToSize method Calling Clear method Setting Capacity explicitly Option 4 Calling TrimExces Which of the following collections operate based on Key ArrayList Hashtable SortedList Stack Which of the following are true about the ArrayList ArrayList can dynamically grow in size ArrayList are of fixed size ArrayList is used for managing KeyValue pair Protected members of...