Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Two Java SE classes are declared as shown below: public class Invoice { public static String formatId ( String oldId ) { return oldId +

Two Java SE classes are declared as shown below:
public class Invoice {
public static String formatId(String oldId){
return oldId +_Invoice;
}
}
public class SalesInvoice extends Invoice {
public static String formatId(String oldId){
return oldId +_SalesInvoice;
}
}
Which of the following statements are true about attempts to use these classes?
a. Invoice invoice = new SalesInvoice();
System.out.println(Invoice.formatId(1234));
Will output 1234_SalesInvoice
b. SalesInvoice invoice=new SalesInvoice();
System.out.println(Invoice.formatId(1234));
Will output 1234_SalesInvoice
c. Invoice invoice = new Invoice();
System.out.println(invoice.formatId(1234));
Will output 1234_Invoice
d. Invoice invoice = new Invoice();
System.out.println((SalesInvoice)Invoice.formatId(1234));
Will output 1234_SalesInvoice
e. SalesInvoice invoice= new SalesInvoice();
System.out.println(invoice.formatId(1234));
Will output 1234_Invoice

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

Samsung Galaxy S23 Ultra Comprehensive User Manual

Authors: Leo Scott

1st Edition

B0BVPBJK5Q, 979-8377286455

Students also viewed these Databases questions

Question

Discuss the rationale of Equation 10.2.

Answered: 1 week ago

Question

What physical locations do you work in?

Answered: 1 week ago