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
tangare [24]
3 years ago
6

11.19 (Constructor Failure) Write a program that shows a constructor passing information about constructor failure to an excepti

on handler. Define class SomeClass, which throws an Exception in the constructor. Your program should try to create an object of type SomeClass and catch the exception that’s thrown from the constructor
Computers and Technology
1 answer:
iren2701 [21]3 years ago
6 0

Answer:

You absolutely should throw an exception from a constructor if you're unable to create a valid object. This allows you to provide proper invariants in your class. ... Throw an exception if you're unable to initialize the object in the constructor, one example are illegal arguments.

Explanation:

You might be interested in
Python Coding:
leva [86]

Answer:

# Here we are asking the user for a number two times

userInput1 = input("Enter any #: ")

userInput2 = input("Enter any # again: ")

# We compare if userInput1 is greater than userInput2

if(userInput1 > userInput2):

   # Print userInput1 if userInput1 is greather than userInput2

   print("First Number: " + userInput1)

   # Otherwise, print userInput2

else:

   print("Second Number: " + userInput2)

# Initiate a while-loop

while(True):

   # The lines below are from above

   userInput1 = input("\nEnter any #: ")

   userInput2 = input("Enter any # again: ")    

   if(userInput1 > userInput2):

       print("First Number: " + userInput1)

   else:

       print("Second Number: " + userInput2)

   # We ask the user whether they would like to stop

   stop = input("\nWould you like to stop? (Yes or No)")

   # Compare the String stop with "Yes"

   if(stop == "Yes"):

       # If true then break

       break

Explanation:

The use of \n is unnecesary, but it skips a line and provides more readability.

5 0
3 years ago
The Register Set that stores temporary results related to the computations are<br>​
Natasha_Volkova [10]

Answer:

ooh Bhai sahab

Explanation:

ooh Bhai Yaar Mata tyo gari sanisanisanisani

5 0
3 years ago
Brainiest To Best Answer!! Java coding help, can you tell me what Switch and Case does using the example below?
fiasKO [112]
The switch statement is an n-way branch. An n-way branch can branch to any of an arbitrary number ( n ) of branches. An if statement can branch two ways, whether the condition is true or false.

The example you gave is a great example of how how code is written can make the code make sense or not.

public void setQuiz( int quiz, int grade )
{
  switch( quiz )
  {
    case 1: // if quiz == 1
      grade1 = grade; //where was grade1 declared?
      break;  // otherwise execution will continue through the next case block
    case 2: // if quiz == 2
      grade2 = grade;
      break;
  }
}

The variable named in the switch statement is tested against each case statement and whichever case statement's value matches, the rest of the switch statement's code is executed. (That's why the break statements are needed) Usually switch statements are written with a default case at the end as a "catchall".
4 0
4 years ago
Ports that are generally used to establish outbound connections are known as ___ ports.
aivan3 [116]

Answer:

Ephemeral

Explanation:

3 0
4 years ago
PLEASE ILL MARK BRAINLIEST
Minchanka [31]

Answer:

it is a capsid

5 0
3 years ago
Other questions:
  • What is an advantage of sharing documents in PDF format instead of Word format?
    6·2 answers
  • It is not possible to use keywords to search for themes
    5·1 answer
  • You are given two int variables j and k, an int array zipcodelist that has been declared and initialized, and an boolean variabl
    7·1 answer
  • Welcome to Cypres...
    6·1 answer
  • When does the VB.NET programming environment start to operate?
    10·1 answer
  • What sound signal tells another boater that you wish to pass on your starboard (right) side?
    15·1 answer
  • Is open office compatible will all web browsers without requiring a plug in?
    8·1 answer
  • __________ systems support the search for and sharing of organizational expertise, decision making, and collaboration at the org
    9·1 answer
  • 2. Which pattern microphone should Jennifer take to the press conference? Jennifer is a journalist with one of the leading newsp
    14·1 answer
  • Write a function that receives a one-dimensional array of integers and returns a Python tuple with two values - the minimum and
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!