Question

Java Questions A class must implement at least one interface. Question 1 options: True False Question...

Java Questions

A class must implement at least one interface.

Question 1 options:

True
False

Question 2 (1 point)

Abstract methods can be called.

Question 2 options:

True
False

Question 3 (1 point)

Constructors

Question 3 options:

Are inherited but cannot be accessed

Are inherited and can be accessed

Are accessible but are not inherited

Are not inherited and cannot be accessed

Question 4 (1 point)

We can instantiate an object from an abstract class.

Question 4 options:

True
False

Question 5 (1 point)

When is it determined which method is called when using polymorphism?

Question 5 options:

At compile time

At the time of writing code

At runtime

Question 6 (1 point)

An abstract method _________________

Question 6 options:

Has a �do-nothing� body

Does not have a body

Has a body, just like another method

Question 7 (1 point)

Assuming the class B inherits from class A and method foo belongs to class A, what do we mean by overriding method foo in class B?

Question 7 options:

We are calling method foo in class B

We are not using method foo in class B

We are replacing the superclass' version of the foo method with a new foo method with the same signature

Question 8 (1 point)

An interface can contain one or more static constants.

Question 8 options:

True
False

Question 9 (1 point)

private fields and methods are inherited.

Question 9 options:

True
False

Question 10 (1 point)

A constructor can be declared abstract.

Question 10 options:

True
False
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 1

False. Not necessarily until class needs to use functions of any interface.

Answer 2

False. Abstract methods are without any body and they are part of abstract class. We can't create object of abstract class so methods can't be called.

Answer 3

Constructors are accessible only but not inherited.

Answer 4

False. Object can not be created for an abstract class.

Answer 5

When we use polymorphism, which method to be called is determined at run time by looking at the type of object which is assigned.

Answer 6

An abstract method does not have any body only declaration.

Answer 7

We are replacing the superclass version of the foo method with a new foo method with the same signature

Answer 8

True. We can have static constants inside interface but it's a bad practice.

Answer 9

False. Private methods are fields are not inherited. Only accessible methods and fields are inherited.

Answer 10

False. To make constructor abstract, you need to implement it it some other class but overriding constructor is not allowed.

Add a comment
Know the answer?
Add Answer to:
Java Questions A class must implement at least one interface. Question 1 options: True False Question...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 83 (1 point) To create a subclass, use the ___ keyword. extends implements interface inherits...

    Question 83 (1 point) To create a subclass, use the ___ keyword. extends implements interface inherits O Question 84 (1 point) Which of the following is true regarding inheritance? A superclass can force a programmer to override a method in any subclass created from it. A superclass cannot prevent a programmer from overriding a method in any subclass created from it. When creating a subclass, all methods of the superclass must be overridden. When creating a subclass, no methods of...

  • In Java Which of the following statements declares Salaried as a subclass of payType? Public class...

    In Java Which of the following statements declares Salaried as a subclass of payType? Public class Salaried implements PayType Public class Salaried derivedFrom(payType) Public class PayType derives Salaried Public class Salaried extends PayType If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method. False True When a subclass overloads a superclass method………. Only the subclass method may be called with a subclass object Only the superclass method...

  • 44 A method signature defines which of the following? (choose all that apply) return type name...

    44 A method signature defines which of the following? (choose all that apply) return type name call parameters body 45 An abstract class can be implemented using the implements keyword. True False 46 An abstract class can be extended using the extends keyword. True False 47 Abstract classes are represented in UML by: italics underline plus/minus bold 48 An abstract class is a superclass for a subclass. True False 49 These symbols are used to denote an interface in a...

  • PRG/421 Week One Analyze Assignment – Analyzing a Java™Program Containing Abstract and Derived Classes 1.    What is...

    PRG/421 Week One Analyze Assignment – Analyzing a Java™Program Containing Abstract and Derived Classes 1.    What is the output of the program as it is written? (Program begins on p. 2) 2. Why would a programmer choose to define a method in an abstract class (such as the Animal constructor method or the getName()method in the code example) vs. defining a method as abstract (such as the makeSound()method in the example)? /********************************************************************** *           Program:          PRG/421 Week 1 Analyze Assignment *           Purpose:         Analyze the coding for...

  • Can someone please help with this in JAVA? Write one application program by using the following...

    Can someone please help with this in JAVA? Write one application program by using the following requirements: 1) Exception handling 2) Inheritance a) At least one superclass or abstract superclass: this class needs to have data members, accessor, mutator, and toString methods b) At least one subclass: this class also needs to have data members, accessor, mutator, and toString methods c) At least one interface: this interface needs to have at least two abstract methods d) At least one method...

  • QUESTION 1 Each class must be declared in its own .java file True or False? QUESTION...

    QUESTION 1 Each class must be declared in its own .java file True or False? QUESTION 2 The keyword this must always be explicitly used when referring to an object's instance variables and methods from within one of its non-static methods. True or False? QUESTION 3 When used in a class' main method the this keyword references the object representing the class itself. True or False? QUESTION 4 Accessor methods that test whether a condition is true or false are...

  • 1.     When a sub class object is created, when is the call to the super class...

    1.     When a sub class object is created, when is the call to the super class constructor made? How does a programmer call the super class constructor from the sub class? What do all classes indirectly extend? What methods does every class inherit from the Object class? 2.     When writing methods in a sub class, how can those methods call the methods from the parent class? 3.     Which class is more specific, a super class or a sub class? 4.    ...

  • true or false in JAVA 1) A literal value is a value that is typed directly...

    true or false in JAVA 1) A literal value is a value that is typed directly into the code, such as 10, 14.6, or "Bob". 2) Local variables can only be accessed from within the block in which they are defined. 3) All variables must be declared before they can be used. 4) If a method returns nothing, its return type should be null. 5) A method with an int parameter can be invoked with a String argument. 6) A...

  • Assignment4: Evaluate Arithmetic Expressions. Requirements: Implement a concrete ArrayStack class that extends the IStack interface as...

    Assignment4: Evaluate Arithmetic Expressions. Requirements: Implement a concrete ArrayStack class that extends the IStack interface as we discussed in the class (any other different Stack class implementation, even if it is implemented by yourself, will not receive any credit). Write a test class called Evaluate and a method that evaluates an arithmatic expression, which is given by a string. import java.util.Scanner; public class Evaluate { public static void main(String[] args) } // your implementation // obtain user's input from keyboard...

  • Subnet mask 255.255.255.0 can never be used for class B network. Question 1 options: True False...

    Subnet mask 255.255.255.0 can never be used for class B network. Question 1 options: True False Question 2 (1 point) In CIDR notation, /22 indicates there are 22 ones in the subnet mask. Question 2 options: True False Question 3 (1 point) When deploy a network inside a commercial building, there must be only one LAN. Question 3 options: True False Question 4 (1 point) When a packet is going to be routed to a computer in a LAN, other...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT