Question

What are the legal array index values? What is a bounds error? What is an instance...

What are the legal array index values? What is a bounds error? What is an instance method, and how does it differ from a static method? How many constructors can a class have? Can you have a class with no constructors? If a class has more than one constructor, which of them gets called?

Homework Answers

Answer #1

What are the legal array index values?
Legal index values are 0 to size-1. if size is 5 than legal indexes are 0,1,2,3,4

What is a bounds error?
If we try to access any illegal index in the array than we will get bound error

What is an instance method, and how does it differ from a static method?
instance methods are object methods which requires object to invoke at.. they are availale for each object as differetncopy
static methods are class level methods these are common to all objects and these methods can be called using class name

How many constructors can a class have?
class can have any number of constructors
Can you have a class with no constructors?
yes we can write but compiler will add the default constructor to it
If a class has more than one constructor, which of them gets called?
It depends on the arguments your passing while creating the object

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName...
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName (a String), numSold (an integer that represents the number of that type of game sold), and priceEach (a double that is the price of each of that type of Game). I only want three instance variables!! The class should have the following methods: A constructor that has two parameter – a String containing the name of the Game and a double containing its price....
Given a class: public class Money { int wholeNumber; int decimalPart; boolean positive; char currencySymbol; }...
Given a class: public class Money { int wholeNumber; int decimalPart; boolean positive; char currencySymbol; } Write a constructor for setting the 4 instance variables (in the order specified above). The constructor must validate the input throwing an IllegalArgumentException (you can specify any error message you see fit) if any of the following conditions are not met: either the int values are negative decimalPart is greater than 99 the currencySymbol is not one of '$', '€', or '£' Write an...
JAVA QUIZ Question 1 Which of the following is false about a "super" call in a...
JAVA QUIZ Question 1 Which of the following is false about a "super" call in a sub class's constructor? Select one: a. It must be the first statement in the constructor b. If you don't include it Java will c. If you don't include it you must have a 0 parameter constructor coded in the super class or no constructors coded at all in the super class d. The sub class constructor containing the super call and the called super...
How do you find the margin of error from the lower and upper bounds of a...
How do you find the margin of error from the lower and upper bounds of a confidence interval? [1 sentence] What is the effect of increasing the standard deviation on the margin of error? [2 sentences] Why does increasing the confidence level result in a larger margin of error? [2 sentences] Why would you be more likely to use a T-interval in a real-world situation than a Z-interval? [2 sentences] When do you use the t-distribution to determine the confidence...
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
This laboratory assignment involves implementing a data structure called a map. A map associates objects called...
This laboratory assignment involves implementing a data structure called a map. A map associates objects called keys with other objects called values. It is implemented as a Java class that uses arrays internally. 1. Theory. A map is a set of key-value pairs. Each key is said to be associated with its corresponding value, so there is at most one pair in the set with a given key. You can perform the following operations on maps. You can test if...
Classes/ Objects(programming language java ) in software (ATOM) Write a Dice class with three data fields...
Classes/ Objects(programming language java ) in software (ATOM) Write a Dice class with three data fields and appropriate types and permissions diceType numSides sideUp The class should have A 0 argument (default) constructor default values are diceType: d6, numSides: 6, sideUp: randomValue 1 argument constructor for the number of sides default values are diceType: d{numSides}, sideUp: randomValue 2 argument constructor for the number of sides and the diceType appropriate accessors and mutators *theoretical question: can you change the number of...
JAVA please Arrays are a very powerful data structure with which you must become very familiar....
JAVA please Arrays are a very powerful data structure with which you must become very familiar. Arrays hold more than one object. The objects must be of the same type. If the array is an integer array then all the objects in the array must be integers. The object in the array is associated with an integer index which can be used to locate the object. The first object of the array has index 0. There are many problems where...
1. Suppose that the integer variables n and m have been initialized. Check all the correct...
1. Suppose that the integer variables n and m have been initialized. Check all the correct statements about the following code fragment. String s2 = (n>=m) ? "one" : ( (m<=2*n) ? "two": "three" ); Question 5 options: If m is strictly greater than 2n then the value of s2 is "two" If n is equal to m then the value of s2 is "two" If m is strictly greater than 2n then the value of s2 is "three" If...
Getting the following errors: Error 1 error C2436: '{ctor}' : member function or nested class in...
Getting the following errors: Error 1 error C2436: '{ctor}' : member function or nested class in constructor initializer list on line 565 Error 2 error C2436: '{ctor}' : member function or nested class in constructor initializer list on line 761 I need this code to COMPILE and RUN, but I cannot get rid of this error. Please Help!! #include #include #include #include using namespace std; enum contactGroupType {// used in extPersonType FAMILY, FRIEND, BUSINESS, UNFILLED }; class addressType { private:...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT