1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Westkost [7]
3 years ago
14

a. Show the output of the following program: 1: public class Test { 2: public static void main ( String [] args ) { 3: A a = new

A( 3 ); 4: } 5: } 6: 7: class A extends B { 8: public A ( int t ) { 9: System.out.println( "A's constructor is invoked" ); 10: } 11: } 12: 13: class B { 14: public B () { 15: System.out.println( "B's constructor is invoked" ); 16: } 17: } b. Is the no-arg constructor of Object invoked when new A(3) is invoked? 6. Indicate true or false for the follow statements: a. You can always successfully cast an instance of a subclass to a superclass. b. You can always successfully cast an instance of a superclass to a subclass. 7. What's wrong with the following code? 1: public class Test { 2: public static void main ( String [] args ) { 3: Object fruit = new Fruit(); 4: Object apple = (Apple) fruit; 5: } 6: } 7: 8: class Apple extends Fruit { 9: } 10: 11: class Fruit { 12: } 8. When overriding the equals method, a common mistake is mistyping its signature in the subclass. For example, the equals method is incorrectly written as equals (Circle circle) as shown in (a) below. It should be written as equals(Object circle), as shown in (b) below. Show the output of running class Test using the Circle class first from (a), and then from (b). Explain the output. 1: public class Test { 2: public static void main ( String [] args ) { 3: Object circle1 = new Circle(); 4: Object circle2 = new Circle(); 5: System.out.println( circle1.equals( circle2 ) );
Computers and Technology
1 answer:
faust18 [17]3 years ago
3 0

Answer:

See attached file.

Explanation:

See attached file.

Download txt
You might be interested in
3. Describe what a pre-processor does in a network-based IDS tool such as Snort. Demonstrate your understanding of this function
MrRissso [65]

Answer:

Pre-processors look at organize traffic and screens parcel transmissions by examining andreassembling divided data.Frag2:preprocessor that battles against IP fracture attacks.Attackers sends a fragmentedTCP bundle with header data that gets entrance through a firewall.At the equivalent time,other parcels with vindictive information "slip" by the firewall undetected because of the fragmentationbeing so little by overwriting the header information.The frag2 pre-processor is specificallydesigned to break down bundle discontinuity to search out noxious information in the sections, which iswhy this pre-processor ought to never be turned off.Stream4:preprocessor Snort uses to coordinate assault marks over numerous packets.Anattacker endeavors to send different parcels into the system conveying parts of the attackpayload which are required to be reassembled by the host so as to start an attack.Stream4 stores the bits of the mark until all bundles are transmitted.Once they are alltransmitted, Stream4 finishes the signature and an alarm is created.

Explanation:

8 0
3 years ago
You’ve been hired to help a bank automate their deposit/withdrawal system! Your task is to write a Python program that interacts
mixer [17]

Answer: See below

Explanation:

<u>Description:</u> In this program, read-option from the user and based on that, perform the operation. And display the balance if the balance is negative.

<u>transactions.py</u>

balance = 1000

#read options from the user

option = input("Deposit or withdrawal: ")

amount = 0

#check if option is a withdrawal

if option == 'withdrawal':

amount = int(input("Enter an amount: "))

balance = balance - amount

#check option is deposit

elif option == 'deposit':

amount = int(input("Enter an amount: "))

balance = balance + amount

else:

print("Invalid transaction.")

#check balance is less than 0 (negative)

if balance < 0:

print("You cannot have a negative balance!")

else:

print("Final balance:",balance)

4 0
2 years ago
The conflict between the user's goal for unfettered access to data and the security administrator's goal to protect that data is
rewona [7]

Answer: Access control

Explanation:Access control is the type of security facility that is provided to the systems in an organization. The functions carried out in maintaining the security of the system is done by authenticating , authorizing and identification of the users and related components . They are secured using the PINs , passwords, bio-metric scan etc.

The situation of the user wanting to have a unrestrained access towards data as well as maintaining the security is the done by access control.

8 0
3 years ago
Read 2 more answers
What is the name of the computer through which e-mail messages are sent and received?
nalin [4]
A mail server. --------------------------------------------
8 0
3 years ago
One of the most<br> common uses of spreadsheet programs are
Bas_tet [7]
Common uses for spreadsheet documents be
-Organizing bills and money
-Groups of people and events
-Family plannings for weeks
-Grocery Lists.

I hope this helps!
8 0
3 years ago
Read 2 more answers
Other questions:
  • Discuss 2D gameplay and how new platforms such as cell phones are taking advantages of this renewed market
    5·1 answer
  • A cast is required in which of the following situations? a. using charAt to take an element of a String and store it in a char b
    7·1 answer
  • A network using multiple cell towers falls under which type of network?
    13·1 answer
  • When creating a firewall exception, what is the difference between opening a port and allowing an application through?
    7·1 answer
  • Motivation is best defined as
    9·2 answers
  • Implement a java program to find the smallest distance between two neighbouring numbers in an array.
    7·1 answer
  • Check my work a(n) ________ reference is an automatically created variable that holds the address of an object and passes it to
    15·1 answer
  • Is a biometric system an input, output, storage or soft device?​
    6·1 answer
  • Melissa is writing a class called Cell. Which method has she set up to return a double?
    7·1 answer
  • How to determine the critical crack size for a<br> plate
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!