Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

List two differences between an abstract class and an interface? Name and describe the two approaches for dealing with an exception. Your answer should indicate

List two differences between an abstract class and an interface?

Name and describe the two approaches for dealing with an exception. Your answer should indicate how they are different from each other.

InputSteam and OutputStream and their subclasses are found in which package?

What is meant by appending a file?

Write a custom exception class with the identifier MyException. You should include a default constructor method and a constructor method that takes a String as a parameter. You can inherit from any existing Exception class.

Java distinguishes between two types of exceptions. What are they and what is the difference between them?

Write an abstract method with the identifier korgramp that is accessible to other classes, does not return any value, and takes two parameters, a String and an int (in that order).

In order to write an object directly to a file using the ObjectOutputStream, what interface must that objects class implement?

To use polymorphism, list 4 conditions that must be met.

Suppose you are overriding a method that has the following header: public void setRank(String s, int i) If this method is designed to modify instance variables that were declared as private in the superclass, what code could you write that would allow you to set those instance variables to the values supplied as the parameters?

Write a class declaration for a class with the identifier Baseball that inherits from the Sport class and implements the Playable interface.

List and briefly describe two benefits of using inheritance when designing classes.

Write some code that will allow you to open a file with the location files/mydata.txt for writing. Then write two variables with the identifiers state and population to the file. You will want to overwrite the existing contents of the file. You do NOT need to handle any exceptions in your code.

Add to the code below so that the given method will generate (throw) a HighlyIllegalParkJobException (with message of your choosing). Note that this exception class is a checked exception. public void someMethod() { }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

What is the derivative of this? F(x) = RT -(P+a/V2) (V-b)

Answered: 1 week ago

Question

LO3 Define job design and identify common approaches to job design.

Answered: 1 week ago