Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Create a Word document containing the answers to all the problems given below.

1. What is an abstract class and how does it differ from a regular class?

2. Why are abstract class constructors defined as protected?

3. Class X defines method M1( ) as abstract. Class Y inherits from Class X and implements the method M1( ). Given the following code, explain why a reference to the abstract class X is allowed to refer to an object of the concrete class Y. Explain what happens when the reference to the abstract class X is used to execute method M1( ). X obj = new Y( ); obj.M1( );

4. What are interfaces allowed to contain?

5. Define a simple interface named Motorized with one method (maxSpeed) which returns the maximum attainable speed and another method (fuelType) which returns the type of fuel required.

6. Given the interface defined in question 5, if a class named Motorcycle implements this interface, explain why the following code is legal. What happens when the interface reference vehicle invokes the maxSpeed method?

Motorized vehicle = new Motorcycle( );

System.out.print("The max speed is %d\n", vehicle.maxSpeed( ) );

7. What is an event object? Give an example.

8. What is an event source? Give an example.

9. What is an event listener? Give an example.

10. What is a nested inner class? What special privileges does a nested inner class have? Give an example of how you declare a nested inner class.

11. You are writing a simple GUI application using a class called MyGuiClass. Your GUI will have a JButton which your program will need to respond to when it is clicked. Describe what you would need to do to setup event handling using a nested inner class. Use Java code fragments in your answer.

12. If the GUI in the above example had three JButtons, how would you change your actionPerformed method to handle events from the three different buttons?

13. Here are some class definitions with questions that follow. interface MyInterface

{

// Methods of MyInterface

}

public SomeClass implements MyInterface

{

// All methods of SomeClass and MyInterface

}
SomeClass obj = new SomeClass( );
a. MyInterface miobj = obj;

b. SomeClass obj2 = miobj;

c. miobj.aMethodOfSomeClass( );

A. Is statement a above legal, or is casting required? Explain.

B. Statement b is trying to assign the SomeClass object refered to by miobj to a SomeClass reference variable obj2. What is wrong with this statement and how would you fix it.

C. In statement c, an interface reference is trying to access a SomeClass class method that is not part of MyInterface. Is this legal? Explain.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91382517
  • Price:- $50

Guranteed 36 Hours Delivery, In Price:- $50

Have any Question?


Related Questions in Computer Engineering

In a competitive market the market demand is qd 60- 6p and

In a competitive market, the market demand is Qd= 60- 6P and the market supply is the Qs= 4P the full economic price under a price ceiling of $3 is:?

Question suppose you have three non-empty stacks r s and t

Question : Suppose you have three non-empty stacks R, S, and T. Describe a sequence of Stack operations that results in S storing all elements originally in T below all of S's original element with both sets of those ele ...

Advertisements suggest that a new window design can save

Advertisements suggest that a new window design can save $400 per year in energy cost over its 30-year life. At an initial cost of $8,000 and zero salvage value, using IRR, is this window a good investment? MARR is 8%.

Write a program that populates an array named weekday from

Write a program that populates an array named weekday from the string SunMonTueWedThuFriSat, and then prints each day in uppercase. PERL Language.

Question 1 with the explosion of users on social media

Question: 1. With the explosion of users on social media sites, businesses need to establish their presence on social media sites. Just search for "Vans" or "Starbucks" on Facebook for examples of company sites. To manag ...

Question suppose a data packet datagram is sent in the

Question : Suppose a data packet (datagram) is sent in the Internet from a source station (computer) to a destination station. What type of addess (physical, MAC, port address or some other) is used to forward the datagr ...

Can someone please help me with this pleasetaskthe purpose

Can Someone please help me with this please: Task: The purpose of this assignment is to empirically measure attributes for binary search trees. Steps: Create a program that will build a binary search tree (BST) by adding ...

Solution must be recursive you are not allowed to use loops

Solution must be recursive. You are not allowed to use loops, or use the Python "in" operator. PYTHON Write a function called first. It is passed a parameter x, that may or may not be a list; if is x is a list it may con ...

In a survey of 3236 adults 1470 say they have started

In a survey of 3236 adults, 1470 say they have started paying bills online in the last year. Construct a? 99% confidence interval for the population proportion. Interpret the results.

Command to mail only the process id of running java program

Command to mail only the process ID of running Java program test to the email address (single line Unix)

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As